( extension_id )
return return_metadata
Get Chrome extension metadata from the Chrome store.
Get Chrome extension metadata from the Chrome store.
Get Chrome extension metadata from the Chrome store .
def get_chrome_extension_metadata( extension_id ):
	"""
	Get Chrome extension metadata from the Chrome store.
	"""
	return_metadata = {}

	headers = {
		"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:49.0) Gecko/20100101 Firefox/49.0",
		"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
		"Accept-Language": "en-US,en;q=0.5",
		"Accept-Encoding": "gzip, deflate, br",
		"X-Same-Domain": "1",
		"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
		"Referer": "https://chrome.google.com/",
	}

	try:
		response = requests.get(
			"https://chrome.google.com/webstore/detail/extension-name/" + extension_id + "?hl=en",
			headers=headers,
			timeout=( 15 ),
		)
	except:
		raise self.retry()

	soup = BeautifulSoup(
		response.text,
		"html.parser"
	)

	version_element = soup.find(
		"meta",
		{ "itemprop": "version" }
	)
	return_metadata[ "version" ] = str( version_element.get( "content" ) )

	name_element = soup.find(
		"meta",
		{ "itemprop": "name" }
	)
	return_metadata[ "name" ] = str( name_element.get( "content" ) )

	url_element = soup.find(
		"meta",
		{ "itemprop": "url" }
	)
	return_metadata[ "url" ] = str( url_element.get( "content" ) )

	image_element = soup.find(
		"meta",
		{ "itemprop": "image" }
	)
	return_metadata[ "image" ] = str( image_element.get( "content" ) )

	download_count_element = soup.find(
		"meta",
		{ "itemprop": "interactionCount" }
	)
	return_metadata[ "download_count" ] = int(
		str(
			download_count_element.get( "content" )
		).replace(
			"UserDownloads:",
			""
		).replace(
			",",
			""
		).replace(
			"+",
			""
		)
	)

	os_element = soup.find(
		"meta",
		{ "itemprop": "operatingSystem" }
	)
	return_metadata[ "os" ] = str( os_element.get( "content" ) )

	rating_element = soup.find(
		"meta",
		{ "itemprop": "ratingValue" }
	)
	return_metadata[ "rating" ] = float( rating_element.get( "content" ) )

	rating_count_element = soup.find(
		"meta",
		{ "itemprop": "ratingCount" }
	)
	return_metadata[ "rating_count" ] = int( rating_count_element.get( "content" ) )

	description_element = soup.find(
		"div",
		{ "itemprop": "description" }
	)
	return_metadata[ "short_description" ] = str( description_element.text )

	return return_metadata
def get_chrome_extension_metadata ( extension_id ) : return_metadata = { } headers = { "User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:49.0) Gecko/20100101 Firefox/49.0" , "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" , "Accept-Language" : "en-US,en;q=0.5" , "Accept-Encoding" : "gzip, deflate, br" , "X-Same-Domain" : "1" , "Content-Type" : "application/x-www-form-urlencoded;charset=utf-8" , "Referer" : "https://chrome.google.com/" , } try : response = requests . get ( "https://chrome.google.com/webstore/detail/extension-name/" + extension_id + "?hl=en" , headers = headers , timeout = ( 15 ) , ) except : raise self . retry ( ) soup = BeautifulSoup ( response . text , "html.parser" ) version_element = soup . find ( "meta" , { "itemprop" : "version" } ) return_metadata [ "version" ] = str ( version_element . get ( "content" ) ) name_element = soup . find ( "meta" , { "itemprop" : "name" } ) return_metadata [ "name" ] = str ( name_element . get ( "content" ) ) url_element = soup . find ( "meta" , { "itemprop" : "url" } ) return_metadata [ "url" ] = str ( url_element . get ( "content" ) ) image_element = soup . find ( "meta" , { "itemprop" : "image" } ) return_metadata [ "image" ] = str ( image_element . get ( "content" ) ) download_count_element = soup . find ( "meta" , { "itemprop" : "interactionCount" } ) return_metadata [ "download_count" ] = int ( str ( download_count_element . get ( "content" ) ) . replace ( "UserDownloads:" , "" ) . replace ( "," , "" ) . replace ( "+" , "" ) ) os_element = soup . find ( "meta" , { "itemprop" : "operatingSystem" } ) return_metadata [ "os" ] = str ( os_element . get ( "content" ) ) rating_element = soup . find ( "meta" , { "itemprop" : "ratingValue" } ) return_metadata [ "rating" ] = float ( rating_element . get ( "content" ) ) rating_count_element = soup . find ( "meta" , { "itemprop" : "ratingCount" } ) return_metadata [ "rating_count" ] = int ( rating_count_element . get ( "content" ) ) description_element = soup . find ( "div" , { "itemprop" : "description" } ) return_metadata [ "short_description" ] = str ( description_element . text ) return return_metadata