mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-11-04 05:47:05 +00:00 
			
		
		
		
	Update acortame.py.
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
from url_shortener import URLShortener
 | 
					from .url_shortener import URLShortener
 | 
				
			||||||
import requests
 | 
					import requests
 | 
				
			||||||
import urllib
 | 
					import urllib.request, urllib.parse, urllib.error
 | 
				
			||||||
class AcortameShortener (URLShortener):
 | 
					class AcortameShortener (URLShortener):
 | 
				
			||||||
 def __init__(self, *args, **kwargs):
 | 
					 def __init__(self, *args, **kwargs):
 | 
				
			||||||
  self.name = "acorta.me"
 | 
					  self.name = "acorta.me"
 | 
				
			||||||
@@ -8,7 +8,7 @@ class AcortameShortener (URLShortener):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 def _shorten (self, url):
 | 
					 def _shorten (self, url):
 | 
				
			||||||
  answer = url
 | 
					  answer = url
 | 
				
			||||||
  api = requests.get ("https://acorta.me/api.php?action=shorturl&format=simple&url=" + urllib.quote(url))
 | 
					  api = requests.get ("https://acorta.me/api.php?action=shorturl&format=simple&url=" + urllib.parse.quote(url))
 | 
				
			||||||
  if api.status_code == 200:
 | 
					  if api.status_code == 200:
 | 
				
			||||||
   answer = api.text
 | 
					   answer = api.text
 | 
				
			||||||
  return answer
 | 
					  return answer
 | 
				
			||||||
@@ -21,7 +21,7 @@ class AcortameShortener (URLShortener):
 | 
				
			|||||||
   #use generic expand method
 | 
					   #use generic expand method
 | 
				
			||||||
   return super(AcortameShortener, self).unshorten(url)
 | 
					   return super(AcortameShortener, self).unshorten(url)
 | 
				
			||||||
  answer = url
 | 
					  answer = url
 | 
				
			||||||
  api = requests.get ("https://acorta.me/api.php?action=expand&format=simple&shorturl=" + urllib.quote(url))
 | 
					  api = requests.get ("https://acorta.me/api.php?action=expand&format=simple&shorturl=" + urllib.parse.quote(url))
 | 
				
			||||||
  if api.status_code == 200:
 | 
					  if api.status_code == 200:
 | 
				
			||||||
   answer = api.text
 | 
					   answer = api.text
 | 
				
			||||||
  return answer
 | 
					  return answer
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user