Create fontlink.py
Created the script.
This commit is contained in:
		
							parent
							
								
									37648ae93f
								
							
						
					
					
						commit
						5179296127
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		
							
								
								
									
										15
									
								
								fontlink.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								fontlink.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					import requests
 | 
				
			||||||
 | 
					from bs4 import BeautifulSoup
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def get_font_links(url):
 | 
				
			||||||
 | 
					    response = requests.get(url)
 | 
				
			||||||
 | 
					    soup = BeautifulSoup(response.text, 'html.parser')
 | 
				
			||||||
 | 
					    fonts_link = []
 | 
				
			||||||
 | 
					    for tag in soup.find_all(["link"]):
 | 
				
			||||||
 | 
					        if 'href' in tag.attrs and (tag['href'].endswith('.woff') or tag['href'].endswith('.woff2') or tag['href'].endswith('.ttf') or tag['href'].endswith('.otf')):
 | 
				
			||||||
 | 
					            fonts_link.append(tag['href'])
 | 
				
			||||||
 | 
					    return fonts_link
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					url = "https://yourlinkhere"
 | 
				
			||||||
 | 
					font_links = get_font_links(url)
 | 
				
			||||||
 | 
					print(font_links)
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue