├── README.md └── manga_panda_downloader.py /README.md: -------------------------------------------------------------------------------- 1 | # 🌟 MANGA DOWNLOADER 🌟 2 | 3 | ---- 4 | 5 | ### `❓ What's it? ❓` 6 | * Manga Downloader is... (I bet you guess) ... a manga downloader in Python 😯😯. 7 | * This project uses _Manga Panda_ Server to download and you can check website out in this link: http://www.mangapanda.com 8 | 9 | ---- 10 | ### `⚒️ Tools ⚒️` 11 | * Google Colab's Account (it's free!) 12 | 13 | ---- 14 | ### `⚙️ Run ⚙️` 15 | * Download `manga_panda_downloader.py` file; 16 | * Open Google Colab in: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiW9vG5n_bsAhUAGrkGHe4-DzcQFjAAegQIARAD&url=https%3A%2F%2Fcolab.research.google.com%2F&usg=AOvVaw3A5aPK2kLFzKOzb6sOckVw ; 17 | * Copy and Paste the code; 18 | * Run it!!! 19 | 20 | ### `📝 Examples 📝` 21 | 22 | * You needa tip Anime's name in lowercase only, else, the code will not work. 23 | * At time,s some pages isn't downloaded: It happens because Manga Panda's Server is overloaded. 24 | * Some examples to download (I suggest you read this mangas, they are awesome): 25 | 26 | ``` 27 | boku-no-hero-academia (290 chapters actually, when I did this code) 28 | we-want-to-talk-about-kaguya (103 chapters actually, when I did this code) 29 | noragami (91 chapters actually, when I did this code) 30 | dragon-ball-super (65 chapters actually, when I did this code) 31 | horimiya (120 chapters actually, when I did this code) 32 | ``` 33 | 34 | * Consider I wanna read the chatper 290 of Boku no Hero Academia (without spoiler, but, this chapter is awesomeeeeeeeeee!!!!!!!!!!), I gonna run the code and tip the two inputs like this: 35 | 36 | ``` 37 | boku-no-hero-academia 38 | 290 39 | ``` 40 | 41 | * And, _voilá_! The chapter is downloaded in your computer (normally on default download folder of your browser). 42 | 43 | ---- 44 | ### `📫 Reach Me 📫` 45 | 46 | > **Email:** **[csfelix08@gmail.com](mailto:csfelix08@gmail.com?)** 47 | 48 | > **Linkedin:** **[linkedin.com/in/csfelix/](https://www.linkedin.com/in/csfelix/)** 49 | 50 | > **Instagram:** **[instagram.com/c0deplus/](https://www.instagram.com/c0deplus/)** 51 | 52 | ---- 53 | 54 | > **Portfolio:** **[CSFelix.io](https://csfelix.github.io/)** 55 | -------------------------------------------------------------------------------- /manga_panda_downloader.py: -------------------------------------------------------------------------------- 1 | ########### 2 | # Imports # 3 | ########### 4 | import re 5 | import urllib.request 6 | from bs4 import BeautifulSoup 7 | import requests 8 | from google.colab import files 9 | 10 | ############# 11 | # Functions # 12 | ############# 13 | def GetUrlPages(img_list, manga_title, chapter): 14 | """ 15 | Get the URL pages and store in a list 16 | """ 17 | for number_page in range(1, 200): 18 | URL = 'http://www.mangapanda.com/{}/{}/{}'.format(manga_title, chapter, number_page) 19 | 20 | # check if the link exists and it's working 21 | request = requests.get(URL) 22 | 23 | if request.status_code == 200: 24 | page = requests.get(URL) # html page's link 25 | page_content = BeautifulSoup(page.content, 'html.parser') # get the content of the page 26 | row_data = [] 27 | 28 | # get the script text image 29 | for row in page_content.findAll('script', 30 | attrs={'type': 'text/javascript'}): 31 | row_data.append(row.text) 32 | 33 | # get only the image's link 34 | img_list.append(re.findall('[^.]ttps.*jpg', row_data[2])) 35 | 36 | else: break 37 | 38 | def RemoveNullPages(img_list): 39 | """ 40 | Remove all null pages in the image's list 41 | """ 42 | for i,x in enumerate(img_list): 43 | if x == []: img_list.remove([]) 44 | 45 | def DownloadPages(img_list, manga_title, chapter): 46 | """ 47 | Download the Pages 48 | """ 49 | for page in range(len(img_list)): 50 | image_url = ''.join(map(str, img_list[page])) 51 | response = requests.get(image_url) 52 | 53 | if response.status_code == 200: 54 | file = open(f"{manga_title} - {chapter} - {page+1}.jpg", "wb") 55 | file.write(response.content) 56 | files.download(f"{manga_title} - {chapter} - {page+1}.jpg") 57 | file.close() 58 | 59 | ############ 60 | # Proccess # 61 | ############ 62 | 63 | if __name__ == '__main__': 64 | try: 65 | img_list = [] 66 | manga_title = input('Manga Name: ') 67 | manga_chapter = int(input('Chapter: ')) 68 | print('\n') 69 | 70 | GetUrlPages(img_list, manga_title, manga_chapter) 71 | RemoveNullPages(img_list) 72 | DownloadPages(img_list, manga_title, manga_chapter) 73 | 74 | except ValueError: print('The manga chapter needa be an integer number.') 75 | except: print('The page does not exist or it is not working now!') --------------------------------------------------------------------------------