我正在尝试插入一些链接,然后对它们进行循环(以输入它们)。
我的代码:
import requests
from requests_html import HTMLSession
import sys
links = []
link = "http://tvil.me"
pagedata = HTMLSession().get(link)
info = pagedata.html.find('#page-right', first=True)
sidra = info.find(".index-episode-caption")
for x in sidra:
link = x.absolute_links
links.append(link)
for i in links:
print(i)
##page = HTMLSession().get(i) - Not working because the response in bottom
##print(page.xpath("//*[contains(@id, 'change-season-')]/a"))
的回应print(i)
:
{'http://www.tvil.me/view/374/2/6/v/מסע_בזמן_Timeless.html'}
{'http://www.tvil.me/view/212/3/22/v/לוציפר_Lucifer.html'}
{'http://www.tvil.me/view/3048/1/7/v/תחנה_19_Station_19.html'}
{'http://www.tvil.me/view/3039/1/10/v/המגדלים_הגבוהים_The_Looming_Tower.html'}
{'http://www.tvil.me/view/109/5/6/v/עמק_הסיליקון_Silicon_Valley.html'}
{'http://www.tvil.me/view/68/5/11/v/ילדה_אבודה_Lost_Girl.html'}
{'http://www.tvil.me/view/556/1/20/v/שלדון_הצעיר_Young_Sheldon.html'}
{'http://www.tvil.me/view/74/4/6/v/מפרשים_שחורים_Black_Sails.html'}
{'http://www.tvil.me/view/360/2/2/v/ווסטוורלד_Westworld.html'}
[Finished in 3.7s]
它用 {' '} 打印,因为它没有进入链接。我该怎么办。