獲取電影天堂的影視連結
阿新 • • 發佈:2019-02-09
import requests
from lxml import etree
import re
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
}
# def xiangqingt(url):
# def ugturl():
for i in range(1,4):
lurl = 'http://www.dytt8.net/html/gndy/dyzz/list_23_%s.html' % i
response = requests.get(lurl,headers=headers)
html_ele = response.text
# print(html_ele)
movie_url_list = re.findall('<a href="(.*)" class="ulink"',html_ele)
# print(movie_url_list)
for movie_item in movie_url_list:
# print(movie_item)
movie_url = 'http://www.dytt8.net' +movie_item
# print(movie_url)
# xiangqingt(movie_url)
response = requests.get(movie_url)
htmls = response.content.decode('gbk')
# print(htmls)
#標題
titlt_name = re.search('<h1><font color=#07519a>(.*)</f',htmls)
# print(titlt_name)
movie_title = titlt_name.group(1)
# print(movie_title)
#磁力
cili_name= re.search('/><a href="(.*)"><str', htmls)
# print(cili_name)
movie_cili = cili_name.group(1)
print(movie_cili)
#種子
zhongzi_name = re.search('ddf"><a href="(.*)">ft',htmls)
movie_zhongzi = zhongzi_name.group(1)
print(movie_zhongzi)
list_title = []
list_title.append(movie_title)
lianjie_name = []
lianjie_name.append(movie_cili)
lianjie_name.append(movie_zhongzi)
# print(lianjie_name)
lianjie_tite = []
lianjie_tite.append(lianjie_name)
# print(lianjie_tite)
movie_dict = (zip(list_title,lianjie_tite))
print(movie_dict)