欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python 實(shí)現(xiàn)自動(dòng)獲取種子磁力鏈接方式

 更新時(shí)間:2020年01月16日 14:59:26   作者:錦城花開  
今天小編就為大家分享一篇Python 實(shí)現(xiàn)自動(dòng)獲取種子磁力鏈接方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

因?yàn)槲议e來無事,所以準(zhǔn)備找一部電影來看看。 然后我找到了種子搜索網(wǎng)站,可是這類網(wǎng)站的彈窗廣告太多,搞得我很煩。所以我就想著自己用python寫一個(gè)自動(dòng)獲取磁力鏈接的腳本。

整個(gè)大概寫了半個(gè)小時(shí)。

代碼如下

import requests
import re
from bs4 import BeautifulSoup
 
  
url="*種子的網(wǎng)站*/"
header={
  "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
  "Accept-Encoding":"gzip, deflate",
  "Accept-Language":"zh-CN,zh;q=0.8",
  "Cache-Control":"max-age=0",
  "Connection":"keep-alive",
  "Content-Length":"65",
  "Content-Type":"application/x-www-form-urlencoded",
  "Host":"btkitty.bid",
  "Origin":"*種子的網(wǎng)站*",
  "Referer":"*種子的網(wǎng)站*/",
  "Upgrade-Insecure-Requests":"1",
  "User-Agent":"Mozilla/5.0 (Windows NT 10.0.14393; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2950.5 Safari/537.36"
  }
while True:
  word=input("輸入搜索關(guān)鍵詞:")
  data={
    "keyword":word,
    "hidden":"true"
    }
  res=requests.post(url,data=data,headers=header)
  bs=BeautifulSoup(res.text,"lxml")
  itemInfo=bs.find_all("dd",class_="option")
  torrent={}
  for item in itemInfo:
    magnet=item.find_next("a",href=re.compile("magnet.*")).attrs["href"]
    name=item.find_previous("a",href=re.compile("*種子的網(wǎng)站*/.*\.html")).text
    size=item.find_next(text=re.compile("\u6587\u4ef6\u5927\u5c0f")).find_next("b").text
    time=item.find_next(text=re.compile("\u6536\u5f55\u65f6\u95f4")).find_next("b").text
    hot=item.find_next(text=re.compile("\u4eba\u6c14")).find_next("b").text
    torrent[name]=[name,time,size,hot,magnet]
 
  for item in torrent:
    print("名稱:",torrent[item][0])
    print("發(fā)布時(shí)間:",torrent[item][1])
    print("大?。?,torrent[item][2])
    print("熱度:",torrent[item][3])
    print("磁力鏈接:",torrent[item][4],'\n')  

運(yùn)行結(jié)果如下

以上這篇Python 實(shí)現(xiàn)自動(dòng)獲取種子磁力鏈接方式就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 探究數(shù)組排序提升Python程序的循環(huán)的運(yùn)行效率的原因

    探究數(shù)組排序提升Python程序的循環(huán)的運(yùn)行效率的原因

    這篇文章主要介紹了探究數(shù)組排序提升Python程序的循環(huán)的運(yùn)行效率的原因,作者用代碼實(shí)踐了多個(gè)小片段來進(jìn)行對(duì)比解釋,需要的朋友可以參考下
    2015-04-04
  • Python人工智能深度學(xué)習(xí)模型訓(xùn)練經(jīng)驗(yàn)總結(jié)

    Python人工智能深度學(xué)習(xí)模型訓(xùn)練經(jīng)驗(yàn)總結(jié)

    這篇文章主要為大家介紹了Python人工智能深度學(xué)習(xí)模型訓(xùn)練的經(jīng)驗(yàn)總結(jié)及建議,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步
    2021-11-11
  • Python利用matplotlib實(shí)現(xiàn)繪制密度散點(diǎn)圖

    Python利用matplotlib實(shí)現(xiàn)繪制密度散點(diǎn)圖

    這篇文章主要介紹了如何基于Python語言的matplotlib模塊,對(duì)Excel表格文件中的指定數(shù)據(jù)加以密度散點(diǎn)圖繪制的方法,有需要的小伙伴可以參考下
    2024-04-04
  • 最新評(píng)論