add get_viewings function
This commit is contained in:
		
							parent
							
								
									056e3b474f
								
							
						
					
					
						commit
						af66ffb2d9
					
				
							
								
								
									
										7
									
								
								.idea/vcs.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.idea/vcs.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project version="4">
 | 
			
		||||
  <component name="VcsDirectoryMappings">
 | 
			
		||||
    <mapping directory="$PROJECT_DIR$" vcs="Git" />
 | 
			
		||||
    <mapping directory="$PROJECT_DIR$/wiki_utils" vcs="Git" />
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										19
									
								
								VCinemaUtils.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								VCinemaUtils.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
from bs4 import BeautifulSoup
 | 
			
		||||
 | 
			
		||||
from wiki_utils.WikiUtils import *
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_vcinema_viewings(token_id, token_secret):
 | 
			
		||||
    # Page ID of /Vcinema/CSV
 | 
			
		||||
    page_id = 11
 | 
			
		||||
 | 
			
		||||
    wiki_base_url = "https://wiki.jacknet.io"
 | 
			
		||||
 | 
			
		||||
    html_page = get_page_export_html(page_id, wiki_base_url, token_id, token_secret)
 | 
			
		||||
 | 
			
		||||
    soup = BeautifulSoup(html_page, 'html.parser')
 | 
			
		||||
    elements = soup.find("code").text.strip().split("\n")
 | 
			
		||||
    headers = elements.pop(0).split(",")
 | 
			
		||||
    viewings = [dict(zip(headers, row.split(","))) for row in elements]
 | 
			
		||||
 | 
			
		||||
    return viewings
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user