悪夢を抱いているので、美しいスープを使ったデスクトップスクレーパーを作っていますが、今はそれをしようとしていますが、それでコーディーにベースコードを追加するのは正しい悪夢です。 。構文エラー、と率直に言って、私はちょうどそれを試してみて、インポートする方法に開始するために理解していないBeautiful Soup Kodiスクレーパー
ここでは私のデスクトップのコードです:
あなたが持っているでしょうurl = input("Enter the direct url for the Tv Show you wish to pull: ")
tvname = input("Enter the name of the TV Show: ")
ui = tvname + '.xml'
response = opener.open(url)
page = response.read()
soup = BeautifulSoup(page, "html.parser")
tv_urls = []
newfile = open(ui, "w")
def get_soup(url):
\t response = opener.open(url)
\t page = response.read()
\t soup = BeautifulSoup(page, "html.parser")
\t return soup
soup = get_soup(url)
seasonepisode =(soup.find_all('td', {'width' : '100%'})[-2].string)
cols=soup.find_all('td', { 'width' : '100%', 'class' : 'entry'})
all_links = [col.find('a').get('href') for col in cols]
tv_urls.extend(all_links)
for url in tv_urls:
\t soup = get_soup(url)
\t title = soup.title.string
\t thumbnail=soup.select_one('td.summary img[src]')['src']
\t cols=soup.find_all('td', { 'width' : '100%', 'class' : 'entry'})
\t all_links = [col.find('a').get('href') for col in cols][1:]
\t string='<item>\n<title>[COLOR lime]' + title + '[/COLOR]</title>\n'
\t for link in all_links:
\t \t string = string + '<link>' + link + '</link>\n'
\t string=string+'<thumbnail>' + thumbnail + '</thumbnail>\n<fanart> </fanart>\n</item>\n\n'
\t newfile.write(string)
\t print((title + ' Tv links scraped'))
print('Done Master Nemzzy')
newfile.close()
ここに私のデスクトップのコードは次のとおりです。 –
私は理解していない申し訳ありませんがthequestionwasが人々を狙って、上記KODIはコディでは動作しませんなぜ、上記のコードがうまくいかないのか知っているので、kodiを知っている人は、何が変わる必要があるのか、何が必要なのかを知っているでしょう。 –