| r38 vs r39 | ||
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 1 | api_url, wiki_url, discuss_doc, discuss_doc = selctwiki() | |
| 14 | 2 | |
| 15 | 3 | headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer {}'.format(APItoken)} |
| 16 | 4 | discuss_headers = {'User-Agent': 'Mozilla/5.0'} |
| ... | ... | |
| 102 | 90 | response = await asession.get("https://{}/discuss/{}".format(wiki_url,discuss_doc),headers=discuss_headers) |
| 103 | 91 | html= await self.alterResponseTry(response) |
| 104 | 92 | self.discuss_state = re.search("\/discuss\/[\w,%,:]*#s-1",str(html)) |
| 105 | ||
| 93 | time.sleep(30) | |
| 106 | 94 | self.state = False |
| 107 | 95 | |
| 108 | 96 | def linkcheckchange(match_obj): |
| ... | ... | |
| 211 | 199 | replace=target['replace'] |
| 212 | 200 | target_backlinks = [] |
| 213 | 201 | backlink_value = '' |
| 214 | ||
| 215 | while | |
| 216 | res = requests.get('https://{}/api/backlink/{}?from={}'.format(api_url,target_doc, backlink_value), headers = headers).json() | |
| 202 | namespaces=[] | |
| 203 | res = requests.get('https://{}/api/backlink/{}'.format(api_url,target_doc), headers = headers).json() | |
| 204 | for namespace in res['namespaces']: | |
| 205 | namespaces.append(namespace['namespace']) | |
| 206 | if len(black_namespaces)>0: #블랙 네임이 있다면 | |
| 207 | for black_namespace in black_namespaces: | |
| 208 | if black_namespace in namespaces: | |
| 209 | namespaces.remove(black_namespace) | |
| 210 | if len(namespaces)>0: | |
| 211 | target_namespace = namespaces.pop(0) | |
| 212 | else: | |
| 213 | target_namespace = None | |
| 214 | while target_namespace != None: | |
| 215 | res = requests.get('https://{}/api/backlink/{}?namespace={}&from={}'.format(api_url,target_doc,target_namespace, backlink_value), headers = headers).json() | |
| 216 | backlinks=res['backlinks'] | |
| 217 | 217 | backlink_value=res['from'] |
| 218 | for doc in | |
| 218 | for doc in backlinks: | |
| 219 | 219 | white=False |
| 220 | 220 | for white_doc in nontargets: |
| 221 | 221 | if doc['document'] == white_doc: |
| ... | ... | |
| 226 | 226 | continue |
| 227 | 227 | target_backlinks.append(doc['document']) |
| 228 | 228 | if backlink_value==None: |
| 229 | break | |
| 229 | if len(namespaces)>0: | |
| 230 | target_namespace = namespaces.pop(0) | |
| 231 | backlink_value='' | |
| 232 | else: | |
| 233 | break | |
| 230 | 234 | for doc in target_backlinks: |
| 231 | 235 | try: |
| 232 | 236 | res = requests.get('https://{}/api/edit/{}'.format(api_url,doc), headers = headers).json() |
| ... | ... | |
| 316 | 320 | json_data = {} |
| 317 | 321 | for target, replace in targets: |
| 318 | 322 | for doc in custom_list: |
| 319 | doc = doc+'Music' | |
| 320 | 323 | try: |
| 321 | 324 | res = requests.get('https://{}/api/edit/{}'.format(api_url,doc), headers = headers).json() |
| 322 | 325 | except: |
| ... | ... |