Files
dotfiles/Userdata/Scripts/rippers/stromberg_Ripper/fetcher.py
T
2020-05-05 10:43:39 +02:00

53 lines
1002 B
Python

import requests
import urllib.request
import time
from bs4 import BeautifulSoup
#url = 'https://www.myspass.de/shows/tvshows/stromberg/#bob-subnavi'
#response = requests.get(url)
#soup = BeautifulSoup(response.text, "html.parser")
soup = BeautifulSoup(open("./site.html"), "html.parser")
divcontents = soup.find(id="content")
divseasons = divcontents.find(id="videoPanel_overlay_10999_full_episode")
divepisodes = divseasons.findAll("div")
href = ""
prevhref = ""
title = ""
info = ""
block = 0
f = open("list.txt", "a")
for div in divepisodes:
title = ""
info = ""
atags = div.findAll("a")
for a in atags:
href = a.get('href')
h2tags = div.findAll("h2")
for h2 in h2tags:
title = h2.text
smalltags = div.findAll("small")
for small in smalltags:
info = small.text
if href != prevhref and title and info and href:
prevhref = href
#f.write("#")
#f.write('\n')
#f.write(title)
#f.write('\n')
#f.write(info)
#f.write('\n')
f.write(href)
f.write('\n')
f.close()