Conversation
|
|
||
| def decrypt(string): | ||
| return base64.b64decode(string[::-1][24:-20]).decode('utf-8') | ||
|
|
||
|
|
There was a problem hiding this comment.
Function scrapeIndex refactored with the following changes:
- Simplify comparison to string length (
simplify-str-len-comparison) - Lift code into else after jump in control flow (
reintroduce-else) - Replace if statement with if expression (
assign-if-exp) - Simplify sequence length comparison (
simplify-len-comparison)
| bluelist = [] | ||
| for ele in soup: | ||
| bluelist.append(ele.get('href')) | ||
| bluelist = [ele.get('href') for ele in soup] |
There was a problem hiding this comment.
Function igggames refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension)
| if not (next_s and isinstance(next_s,NavigableString)): | ||
| if not next_s or not isinstance(next_s, NavigableString): |
There was a problem hiding this comment.
Function scrappers refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan) - Use f-string instead of string concatenation (
use-fstring-for-concatenation) - Replace a for append loop with list extend [×2] (
for-append-to-extend)
| datalist = [] | ||
| for ele in soup: | ||
| datalist.append(ele.get("value")) | ||
|
|
||
| datalist = [ele.get("value") for ele in soup] |
There was a problem hiding this comment.
Function getfinal refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension) - Inline variable that is immediately returned (
inline-immediately-returned-variable) - Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| datalist = [] | ||
| for ele in soup: | ||
| datalist.append(ele.get("value")) | ||
| datalist = [ele.get("value") for ele in soup] |
There was a problem hiding this comment.
Function getfirst refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension)
| info_parsed = {} | ||
| for i in range(0, len(f), 3): | ||
| info_parsed[f[i].lower().replace(' ', '_')] = f[i+2] | ||
| return info_parsed | ||
| return {f[i].lower().replace(' ', '_'): f[i+2] for i in range(0, len(f), 3)} |
There was a problem hiding this comment.
Function parse_info_sharer refactored with the following changes:
- Convert for loop into dictionary comprehension (
dict-comprehension) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| res = client.post(url+'/dl', headers=headers, data=data).json() | ||
| res = client.post(f'{url}/dl', headers=headers, data=data).json() | ||
| except: | ||
| return info_parsed | ||
| if 'url' in res and res['url']: | ||
| info_parsed['error'] = False | ||
| info_parsed['gdrive_link'] = res['url'] | ||
| if len(ddl_btn) and not forced_login and not 'url' in info_parsed: | ||
| if len(ddl_btn) and not forced_login and 'url' not in info_parsed: |
There was a problem hiding this comment.
Function sharer_pw refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation) - Simplify logical expression using De Morgan identities (
de-morgan)
| bypassed_url = client.post(domain+"links/go", data=data, headers=headers).json()["url"] | ||
| bypassed_url = client.post( | ||
| f"{domain}links/go", data=data, headers=headers | ||
| ).json()["url"] |
There was a problem hiding this comment.
Function gplinks refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
|
|
There was a problem hiding this comment.
Function droplink refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else) - Replace if statement with if expression (
assign-if-exp)
| if response["success"]: return response["destination"] | ||
| else: return response["msg"] | ||
| return response["destination"] if response["success"] else response["msg"] |
There was a problem hiding this comment.
Function linkvertise refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| url_base += matches[0]+'/' | ||
| url_base += f'{matches[0]}/' | ||
| params = matches[1] | ||
| res = client.get(url_base+'anchor', params=params) | ||
| res = client.get(f'{url_base}anchor', params=params) | ||
| token = re.findall(r'"recaptcha-token" value="(.*?)"', res.text)[0] | ||
| params = dict(pair.split('=') for pair in params.split('&')) | ||
| post_data = post_data.format(params["v"], token, params["k"], params["co"]) | ||
| res = client.post(url_base+'reload', params=f'k={params["k"]}', data=post_data) | ||
| answer = re.findall(r'"rresp","(.*?)"', res.text)[0] | ||
| return answer | ||
| res = client.post( | ||
| f'{url_base}reload', params=f'k={params["k"]}', data=post_data | ||
| ) | ||
| return re.findall(r'"rresp","(.*?)"', res.text)[0] |
There was a problem hiding this comment.
Function RecaptchaV3 refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| else: TERA_COOKIE = {"ndus": ndus} | ||
|
|
||
|
|
||
| TERA_COOKIE = None if ndus is None else {"ndus": ndus} |
There was a problem hiding this comment.
Lines 19-22 refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| link = findall(r'\bhttps?://.*\.uptobox\.com/dl\S+', url) | ||
| if link: return link[0] | ||
| if link := findall(r'\bhttps?://.*\.uptobox\.com/dl\S+', url): | ||
| return link[0] |
There was a problem hiding this comment.
Function uptobox refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| final_link = findall(r'https?:\/\/download\d+\.mediafire\.com\/\S+\/\S+\/\S+', url) | ||
| if final_link: return final_link[0] | ||
| if final_link := findall( | ||
| r'https?:\/\/download\d+\.mediafire\.com\/\S+\/\S+\/\S+', url | ||
| ): | ||
| return final_link[0] | ||
| cget = create_scraper().request | ||
| try: | ||
| url = cget('get', url).url | ||
| page = cget('get', url).text | ||
| except Exception as e: | ||
| return (f"ERROR: {e.__class__.__name__}") | ||
| final_link = findall(r"\'(https?:\/\/download\d+\.mediafire\.com\/\S+\/\S+\/\S+)\'", page) | ||
| if not final_link:return ("ERROR: No links found in this page") | ||
| return final_link[0] | ||
| if final_link := findall( | ||
| r"\'(https?:\/\/download\d+\.mediafire\.com\/\S+\/\S+\/\S+)\'", page | ||
| ): | ||
| return final_link[0] | ||
| else: | ||
| return ("ERROR: No links found in this page") |
There was a problem hiding this comment.
Function mediafire refactored with the following changes:
- Use named expression to simplify assignment and conditional [×2] (
use-named-expression) - Lift code into else after jump in control flow (
reintroduce-else) - Swap if/else branches (
swap-if-else-branches)
| direct_link = findall(r"(https?://letsupload\.io\/.+?)\'", res.text) | ||
| if direct_link: return direct_link[0] | ||
| if direct_link := findall(r"(https?://letsupload\.io\/.+?)\'", res.text): | ||
| if direct_link: return direct_link[0] |
There was a problem hiding this comment.
Function letsupload refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| direct_link = html_tree.xpath("//a[contains(@id,'uniqueExpirylink')]/@href") | ||
| if direct_link: | ||
| if direct_link := html_tree.xpath( | ||
| "//a[contains(@id,'uniqueExpirylink')]/@href" | ||
| ): |
There was a problem hiding this comment.
Function racaty refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| dl_url = soup.find("a", {"class": "ok btn-general btn-orange"})["href"] | ||
| if dl_url: return dl_url | ||
| if dl_url := soup.find("a", {"class": "ok btn-general btn-orange"})[ | ||
| "href" | ||
| ]: | ||
| return dl_url | ||
| return ( | ||
| "ERROR: Unable to generate Direct Link 1fichier!") | ||
| elif len(soup.find_all("div", {"class": "ct_warn"})) == 3: | ||
| str_2 = soup.find_all("div", {"class": "ct_warn"})[-1] | ||
| if "you must wait" in str(str_2).lower(): | ||
| numbers = [int(word) for word in str(str_2).split() if word.isdigit()] | ||
| if numbers: return ( | ||
| f"ERROR: 1fichier is on a limit. Please wait {numbers[0]} minute.") | ||
| if numbers := [ | ||
| int(word) for word in str(str_2).split() if word.isdigit() | ||
| ]: | ||
| if numbers: return ( | ||
| f"ERROR: 1fichier is on a limit. Please wait {numbers[0]} minute.") |
There was a problem hiding this comment.
Function fichier refactored with the following changes:
- Use named expression to simplify assignment and conditional [×3] (
use-named-expression)
| if TERA_COOKIE is None: return f"Terabox Cookie is not Set" | ||
| if TERA_COOKIE is None: | ||
| return "Terabox Cookie is not Set" |
There was a problem hiding this comment.
Function terabox refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring)
| direct_link = html_tree.xpath("//a[contains(@class,'btn btn-dow')]/@href") | ||
| if direct_link: | ||
| if direct_link := html_tree.xpath( | ||
| "//a[contains(@class,'btn btn-dow')]/@href" | ||
| ): |
There was a problem hiding this comment.
Function akmfiles refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| urls = [] | ||
| if otherss: texts = message.caption | ||
| else: texts = message.text | ||
|
|
||
| texts = message.caption if otherss else message.text | ||
| if texts in [None,""]: return | ||
| for ele in texts.split(): | ||
| if "http://" in ele or "https://" in ele: | ||
| urls.append(ele) | ||
| if len(urls) == 0: return | ||
| urls = [ele for ele in texts.split() if "http://" in ele or "https://" in ele] | ||
| if not urls: return | ||
|
|
||
| if bypasser.ispresent(ddllist,urls[0]): | ||
| msg = app.send_message(message.chat.id, "⚡ __generating...__", reply_to_message_id=message.id) | ||
| elif urls[0] in "https://olamovies" or urls[0] in "https://psa.pm/": | ||
| msg = app.send_message(message.chat.id, "🔎 __this might take some time...__", reply_to_message_id=message.id) | ||
| else: | ||
| if urls[0] in "https://olamovies" or urls[0] in "https://psa.pm/": | ||
| msg = app.send_message(message.chat.id, "🔎 __this might take some time...__", reply_to_message_id=message.id) | ||
| else: | ||
| msg = app.send_message(message.chat.id, "🔎 __bypassing...__", reply_to_message_id=message.id) | ||
| msg = app.send_message(message.chat.id, "🔎 __bypassing...__", reply_to_message_id=message.id) |
There was a problem hiding this comment.
Function loopthread refactored with the following changes:
- Move assignment closer to its usage within a block (
move-assign-in-block) - Replace if statement with if expression (
assign-if-exp) - Simplify sequence length comparison (
simplify-len-comparison) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation) - Merge else clause's nested if statement into elif (
merge-else-if-into-elif) - Convert for loop into list comprehension (
list-comprehension)
Branch
mainrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
mainbranch, then run:Help us improve this pull request!