Skip to content

Instantly share code, notes, and snippets.

@Muminur
Forked from aniruddha-adhikary/apk_download.py
Created March 25, 2016 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Muminur/3d0009fcc4fec3484db7 to your computer and use it in GitHub Desktop.
Save Muminur/3d0009fcc4fec3484db7 to your computer and use it in GitHub Desktop.
import requests
from BeautifulSoup import BeautifulSoup as BS
import re
def get_dl_page(package_id):
get_request = requests.get('https://apkpure.com/search?q=' + package_id)
page = BS(get_request.text)
# it is assumed that the first search result is the thing we are looking for
link_ps = page.findAll('p', {'class': 'search-title'})
page_link = link_ps[0].a.get('href')
return 'https://apkpure.com' + page_link
def get_dl_link(page_link):
get_request = requests.get(page_link)
page = BS(get_request.text)
# it is assumed that the first search result is the thing we are looking for
link_ps = page.find('div', {"id": 'faq_box'}).findAll('a', {'ga': re.compile('download.*')})
return link_ps[0].get('href')
print get_dl_link(get_dl_page('your.package.id.goes.here'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment