ソースを参照

Fonction get_img pour récupérer l'image d'un manga

master
TheBidouilleur 2週間前
コミット
83e9fa6d30
1個のファイルの変更15行の追加1行の削除
  1. +15
    -1
      mangadex.py

+ 15
- 1
mangadex.py ファイルの表示

@@ -2,7 +2,7 @@
import urllib.request
from bs4 import BeautifulSoup

url = "https://mangadex.org/title/31477"

def get_title(url):
fp = urllib.request.urlopen(url)
@@ -15,6 +15,16 @@ def get_title(url):
title = code
title = title[:-18]
return title
def get_img(url):
fp = urllib.request.urlopen(url)
mybytes = fp.read()
html = mybytes.decode("utf8")
fp.close()
soup = BeautifulSoup(html, "html5lib")

dict = str(soup.find('a', {'title' : 'See covers'})).split('"')
return dict[7]


def get_author(url):
fp = urllib.request.urlopen(url)
@@ -50,6 +60,7 @@ def get_last_chap(url):
return chap[0]

def main():
url = "https://mangadex.org/title/31477"
title = get_title(url)
print("Titre de l'anime : %s " % title)
author = get_author(url)
@@ -61,5 +72,8 @@ def main():
link = get_url(get_id(url))
print("Url mangadex : %s" % link)


print("Image : %s" % get_img(url))

if __name__ == '__main__':
main()

読み込み中…
キャンセル
保存