├── LICENSE ├── README.md ├── igg_scraper.py └── requirements.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 JulianGi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IGGScraper 2 | A web scraper for igg-games.com written in Python 3 that provides direct download links of any specified game. 3 | Quick and easy to use. Built with urllib and BeautifulSoup. 4 | -------------------------------------------------------------------------------- /igg_scraper.py: -------------------------------------------------------------------------------- 1 | try: 2 | from bs4 import BeautifulSoup 3 | import urllib.request 4 | import re 5 | import pyperclip 6 | except ImportError: 7 | print("Some modules are not installed. Run \n python -m pip install -r requirements.txt") 8 | exit() 9 | 10 | # credit tingtingths https://greasyfork.org/en/scripts/423435-igg-games-bluemediafiles-bypass/code 11 | # Decryption process of the Goroi_n_Create_Button token 12 | def _bluemediafiles_decodeKey(encoded): 13 | key = '' 14 | i = int(len(encoded) / 2 - 5) 15 | while i >= 0: 16 | key += encoded[i] 17 | i = i - 2 18 | i = int(len(encoded) / 2 + 4) 19 | while i < len(encoded): 20 | key += encoded[i] 21 | i = i + 2 22 | return key 23 | 24 | 25 | def url_generator_link_decode(link): 26 | sec_req = urllib.request.Request( 27 | link, 28 | data=None, 29 | headers={ 30 | 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' 31 | } 32 | ) 33 | try: 34 | request = urllib.request.urlopen(sec_req) 35 | 36 | except urllib.error.URLError: 37 | return "URL could not be opened." 38 | 39 | soup = BeautifulSoup(request, "lxml") 40 | 41 | for script in soup.find_all("script"): 42 | matches = re.findall(r"Goroi_n_Create_Button\(\"(.*?)\"\)", str(script)) 43 | if len(matches) > 0: 44 | string = 'https://bluemediafiles.com/get-url.php?url=' + _bluemediafiles_decodeKey(matches[0]) 45 | third_req = urllib.request.Request( 46 | string, 47 | data=None, 48 | headers={ 49 | 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' 50 | } 51 | ) 52 | try: 53 | request = urllib.request.urlopen(third_req) 54 | except urllib.error.URLError: 55 | print("URL could not be opened.") 56 | continue 57 | result_url = request.geturl() 58 | if("mega.nz" in result_url): 59 | result_url = result_url.replace("%23", "#") 60 | return result_url 61 | 62 | 63 | 64 | def main(): 65 | 66 | url_choice = input("IGG-Games Link: ") 67 | if not (url_choice.startswith("http://") or url_choice.startswith("https://")): 68 | url_choice = "http://" + url_choice 69 | req = urllib.request.Request( 70 | url_choice, 71 | data=None, 72 | headers={ 73 | 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' 74 | } 75 | ) 76 | 77 | try: 78 | request = urllib.request.urlopen(req) 79 | except urllib.error.URLError: 80 | print("URL could not be opened.") 81 | exit() 82 | 83 | soup = BeautifulSoup(request, "lxml") 84 | source_list = [] 85 | 86 | # Iterate through all sources 87 | for source in soup.find_all("b"): 88 | source_list += re.findall( 89 | r"Link [0-9]*[a-zA-Z]+\.* *[0-9]*[a-zA-Z]+\.*[a-zA-Z]*", str(source)) 90 | # Remove torrent link if available 91 | if str(source).__contains__("TORRENT"): 92 | source_list.pop(0) 93 | 94 | # Remove 'Link' text from source_list 95 | for count in range(len(source_list)): 96 | item = source_list[count] 97 | source_list[count] = item[5:] 98 | 99 | if not source_list: 100 | print("No Link sources found.") 101 | exit() 102 | for counter, value in enumerate(source_list): 103 | print(str(counter + 1) + ") " + value) 104 | source_choice = input("Choose download source: ") 105 | while not isinstance(source_choice, int): 106 | try: 107 | source_choice = int(source_choice) 108 | if source_choice > len(source_list): 109 | raise ValueError 110 | except ValueError: 111 | source_choice = input( 112 | "Please enter a number between 1 and " + str(len(source_list)) + ": ") 113 | 114 | finalOutput = "" 115 | isUpdate = False 116 | 117 | for paragraph in soup.find_all("p"): 118 | if(isUpdate): 119 | for hyperlink in paragraph("a"): 120 | link = hyperlink.get("href") 121 | if("url-generator" in link): 122 | link = url_generator_link_decode(link) 123 | print(link) 124 | isUpdate = False 125 | for span in paragraph("span"): 126 | if("UPDATE" in span.text): 127 | print(span.text) 128 | isUpdate = True 129 | 130 | if source_list[source_choice - 1] in paragraph.text: 131 | print("\n") 132 | for hyperlink in paragraph("a"): 133 | string = hyperlink.get('href') 134 | # Check if button is already redirecting to direct link 135 | if "http://bluemediafiles.com" not in string: 136 | sec_req = urllib.request.Request( 137 | string, 138 | data=None, 139 | headers={ 140 | 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' 141 | } 142 | ) 143 | try: 144 | request = urllib.request.urlopen(sec_req) 145 | except urllib.error.URLError: 146 | print("URL could not be opened.") 147 | continue; 148 | print(request.geturl()) 149 | finalOutput += request.geturl() + "\n" 150 | else: 151 | sec_req = urllib.request.Request( 152 | string, 153 | data=None, 154 | headers={ 155 | 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' 156 | } 157 | ) 158 | try: 159 | request = urllib.request.urlopen(sec_req) 160 | except urllib.error.URLError: 161 | print("URL could not be opened.") 162 | continue; 163 | 164 | soup = BeautifulSoup(request, "lxml") 165 | 166 | for script in soup.find_all("script"): 167 | matches = re.findall( 168 | r"Goroi_n_Create_Button\(\"(.*?)\"\)", str(script)) 169 | if len(matches) > 0: 170 | string = 'https://bluemediafiles.com/get-url.php?url=' + \ 171 | _bluemediafiles_decodeKey(matches[0]) 172 | third_req = urllib.request.Request( 173 | string, 174 | data=None, 175 | headers={ 176 | 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' 177 | } 178 | ) 179 | try: 180 | request = urllib.request.urlopen(third_req) 181 | except urllib.error.URLError: 182 | print("URL could not be opened.") 183 | continue 184 | result_url = request.geturl() 185 | if("mega.nz" in result_url): 186 | result_url = result_url.replace("%23", "#") 187 | print(result_url) 188 | finalOutput += request.geturl() + "\n" 189 | 190 | print("\n") 191 | if input("Copy to Clipboard? y/n ").lower() == "y": 192 | pyperclip.copy(finalOutput) 193 | 194 | 195 | main() 196 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | bs4 2 | lxml 3 | pyperclip --------------------------------------------------------------------------------