佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > python 爬取影視網(wǎng)站下載鏈接

python 爬取影視網(wǎng)站下載鏈接

熱門(mén)標(biāo)簽:百度AI接口 語(yǔ)音系統(tǒng) 客戶服務(wù) 呼叫中心市場(chǎng)需求 企業(yè)做大做強(qiáng) 硅谷的囚徒呼叫中心 Win7旗艦版 電話運(yùn)營(yíng)中心

項(xiàng)目地址:

https://github.com/GriffinLewis2001/Python_movie_links_scraper

運(yùn)行效果

導(dǎo)入模塊

import requests,re
from requests.cookies import RequestsCookieJar
from fake_useragent import UserAgent
import os,pickle,threading,time
import concurrent.futures
from goto import with_goto

爬蟲(chóng)主代碼

def get_content_url_name(url):
    send_headers = {
     "User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
    "Connection": "keep-alive",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "Accept-Language": "zh-CN,zh;q=0.8"

        }
    cookie_jar = RequestsCookieJar()
    cookie_jar.set("mttp", "9740fe449238", domain="www.yikedy.co")
    response=requests.get(url,send_headers,cookies=cookie_jar)
    response.encoding='utf-8'
    content=response.text
    reg=re.compile(r'a href="(.*?)" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  class="thumbnail-img" title="(.*?)"')
    url_name_list=reg.findall(content)
    return url_name_list

def get_content(url):
    send_headers = {
     "User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
    "Connection": "keep-alive",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "Accept-Language": "zh-CN,zh;q=0.8"

        }
    cookie_jar = RequestsCookieJar()
    cookie_jar.set("mttp", "9740fe449238", domain="www.yikedy.co")
    response=requests.get(url,send_headers,cookies=cookie_jar)
    response.encoding='utf-8'
    return response.text



def search_durl(url):
    content=get_content(url)
    reg=re.compile(r"{'\\x64\\x65\\x63\\x72\\x69\\x70\\x74\\x50\\x61\\x72\\x61\\x6d':'(.*?)'}")
    index=reg.findall(content)[0]
    download_url=url[:-5]+r'/downloadList?decriptParam='+index
    content=get_content(download_url)
    reg1=re.compile(r'title=".*?" href="(.*?)" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ')
    download_list=reg1.findall(content)
    return download_list
def get_page(url):
    send_headers = {
     "User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
    "Connection": "keep-alive",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "Accept-Language": "zh-CN,zh;q=0.8"

        }
    cookie_jar = RequestsCookieJar()
    cookie_jar.set("mttp", "9740fe449238", domain="www.yikedy.co")
    response=requests.get(url,send_headers,cookies=cookie_jar)
    response.encoding='utf-8'
    content=response.text
    reg=re.compile(r'a target="_blank" class="title" href="(.*?)" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  title="(.*?)">(.*?)\/a>')
    url_name_list=reg.findall(content)
    return url_name_list
@with_goto
def main():

    print("=========================================================")
    name=input("請(qǐng)輸入劇名(輸入quit退出):")
    if name == "quit":
        exit()
    url="http://www.yikedy.co/search?query="+name
    dlist=get_page(url)
    print("\n")
    if(dlist):
        num=0
        count=0
        for i in dlist:
            if (name in i[1]) :
                print(f"{num} {i[1]}")
                num+=1
            elif num==0 and count==len(dlist)-1:
                goto .end
            count+=1
        dest=int(input("\n\n請(qǐng)輸入劇的編號(hào)(輸100跳過(guò)此次搜尋):"))
        if dest == 100:
            goto .end
        x=0
        print("\n以下為下載鏈接:\n")
        for i in dlist:
            if (name in i[1]):
                if(x==dest):
                    for durl in search_durl(i[0]):
                        print(f"{durl}\n")

                    print("\n")

                    break
                x+=1

    else:
        label .end
        print("沒(méi)找到或不想看\n")

完整代碼

import requests,re
from requests.cookies import RequestsCookieJar
from fake_useragent import UserAgent
import os,pickle,threading,time
import concurrent.futures
from goto import with_goto

def get_content_url_name(url):
    send_headers = {
     "User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
    "Connection": "keep-alive",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "Accept-Language": "zh-CN,zh;q=0.8"

        }
    cookie_jar = RequestsCookieJar()
    cookie_jar.set("mttp", "9740fe449238", domain="www.yikedy.co")
    response=requests.get(url,send_headers,cookies=cookie_jar)
    response.encoding='utf-8'
    content=response.text
    reg=re.compile(r'a href="(.*?)" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  class="thumbnail-img" title="(.*?)"')
    url_name_list=reg.findall(content)
    return url_name_list

def get_content(url):
    send_headers = {
     "User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
    "Connection": "keep-alive",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "Accept-Language": "zh-CN,zh;q=0.8"

        }
    cookie_jar = RequestsCookieJar()
    cookie_jar.set("mttp", "9740fe449238", domain="www.yikedy.co")
    response=requests.get(url,send_headers,cookies=cookie_jar)
    response.encoding='utf-8'
    return response.text



def search_durl(url):
    content=get_content(url)
    reg=re.compile(r"{'\\x64\\x65\\x63\\x72\\x69\\x70\\x74\\x50\\x61\\x72\\x61\\x6d':'(.*?)'}")
    index=reg.findall(content)[0]
    download_url=url[:-5]+r'/downloadList?decriptParam='+index
    content=get_content(download_url)
    reg1=re.compile(r'title=".*?" href="(.*?)" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ')
    download_list=reg1.findall(content)
    return download_list
def get_page(url):
    send_headers = {
     "User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
    "Connection": "keep-alive",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "Accept-Language": "zh-CN,zh;q=0.8"

        }
    cookie_jar = RequestsCookieJar()
    cookie_jar.set("mttp", "9740fe449238", domain="www.yikedy.co")
    response=requests.get(url,send_headers,cookies=cookie_jar)
    response.encoding='utf-8'
    content=response.text
    reg=re.compile(r'a target="_blank" class="title" href="(.*?)" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  title="(.*?)">(.*?)\/a>')
    url_name_list=reg.findall(content)
    return url_name_list
@with_goto
def main():

    print("=========================================================")
    name=input("請(qǐng)輸入劇名(輸入quit退出):")
    if name == "quit":
        exit()
    url="http://www.yikedy.co/search?query="+name
    dlist=get_page(url)
    print("\n")
    if(dlist):
        num=0
        count=0
        for i in dlist:
            if (name in i[1]) :
                print(f"{num} {i[1]}")
                num+=1
            elif num==0 and count==len(dlist)-1:
                goto .end
            count+=1
        dest=int(input("\n\n請(qǐng)輸入劇的編號(hào)(輸100跳過(guò)此次搜尋):"))
        if dest == 100:
            goto .end
        x=0
        print("\n以下為下載鏈接:\n")
        for i in dlist:
            if (name in i[1]):
                if(x==dest):
                    for durl in search_durl(i[0]):
                        print(f"{durl}\n")

                    print("\n")

                    break
                x+=1

    else:
        label .end
        print("沒(méi)找到或不想看\n")

print("本軟件由CLY.所有\(zhòng)n\n")
while(True):
    main()

以上就是python 爬取影視網(wǎng)站下載鏈接的詳細(xì)內(nèi)容,更多關(guān)于python 爬取下載鏈接的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

您可能感興趣的文章:
  • python 爬取吉首大學(xué)網(wǎng)站成績(jī)單
  • python趣味挑戰(zhàn)之爬取天氣與微博熱搜并自動(dòng)發(fā)給微信好友
  • Python爬蟲(chóng)之爬取我愛(ài)我家二手房數(shù)據(jù)
  • python 爬取京東指定商品評(píng)論并進(jìn)行情感分析
  • python結(jié)合多線程爬取英雄聯(lián)盟皮膚(原理分析)
  • python爬取豆瓣電影TOP250數(shù)據(jù)
  • python爬取鏈家二手房的數(shù)據(jù)
  • 教你怎么用python爬取愛(ài)奇藝熱門(mén)電影
  • Python爬蟲(chóng)之爬取最新更新的小說(shuō)網(wǎng)站
  • Python爬蟲(chóng)實(shí)戰(zhàn)之爬取攜程評(píng)論

標(biāo)簽:喀什 山西 長(zhǎng)沙 濟(jì)南 安康 海南 崇左 山西

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《python 爬取影視網(wǎng)站下載鏈接》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    洱源县| 威宁| 英吉沙县| 扶沟县| 治多县| 八宿县| 萝北县| 英超| 金沙县| 四会市| 吴江市| 仪陇县| 遂昌县| 定西市| 南安市| 策勒县| 海宁市| 临颍县| 如东县| 西畴县| 民勤县| 化隆| 榆社县| 兴城市| 萝北县| 罗山县| 遂溪县| 泸西县| 汝城县| 漳州市| 三亚市| 许昌县| 临安市| 玛曲县| 屯门区| 漳州市| 府谷县| 海安县| 滕州市| 三穗县| 霸州市|