File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 uses : lycheeverse/lychee-action@v1.9.0
3737 with :
3838 lycheeVersion : ' 0.12.0'
39- args : --user-agent "${{ env.USER_AGENT }}" --base=https://buddhistuniversity.net --exclude-link-local --timeout=30 --retry-wait-time=3 --max-redirects=8 --exclude=researchgate.net --exclude=illeakyw.sirv.com --exclude=googleapis.com --exclude=google.com --exclude=apple.com --exclude=accesstoinsight.org --exclude=suttacentral.net --exclude=dhammawheel.com --exclude=doi.org --exclude=archive.org --exclude=github.com --exclude=openlibrary.org --exclude= google-analytics.com --exclude=worldcat.org --exclude=ssrn.com --exclude=schema.org --exclude=substack.com --exclude=science.org --exclude=pnas.org --exclude=tandfonline.com --exclude=archive.is --exclude=wiley.com --exclude=gstatic.com --exclude-mail --verbose --no-progress --cache --exclude-path=prod/content 'prod/**/*.html' 'main/_content/*/*.txt' prod/site.webmanifest prod/browserconfig.xml
39+ args : --user-agent "${{ env.USER_AGENT }}" --base=https://buddhistuniversity.net --exclude-link-local --timeout=30 --retry-wait-time=3 --max-redirects=8 --exclude=researchgate.net --exclude=illeakyw.sirv.com --exclude=googleapis.com --exclude=google.com --exclude=apple.com --exclude=accesstoinsight.org --exclude=suttacentral.net --exclude=dhammawheel.com --exclude=doi.org --exclude=archive.org --exclude=github.com --exclude=google-analytics.com --exclude=worldcat.org --exclude=ssrn.com --exclude=schema.org --exclude=substack.com --exclude=science.org --exclude=pnas.org --exclude=tandfonline.com --exclude=archive.is --exclude=wiley.com --exclude=gstatic.com --exclude-mail --verbose --no-progress --cache --exclude-path=prod/content 'prod/**/*.html' 'main/_content/*/*.txt' prod/site.webmanifest prod/browserconfig.xml
4040 - name : Create GitHub Issue
4141 uses : peter-evans/create-issue-from-file@v4
4242 with :
Original file line number Diff line number Diff line change 22title : " Walking the Noble Path"
33authors : [tnh]
44year : 2012
5+ olid : OL51559150M
56publisher : parallax
67tags :
78 - ethics
Original file line number Diff line number Diff line change 66< div class ="featured_content_list "> < ul >
77 {% for c in sorted %}
88 < li class ="featured_content_list_item ">
9- {% if c.olid %}< div class ="ol-cover "> < a href ="{{ c.url }} "> {{ c.title | markdownify | strip_html }}< img src ="https://covers.openlibrary.org/b/olid/ {{ c.olid }}-L .jpg " alt ="{{ c.title }} "> </ a > </ div > {% else %}
9+ {% if c.olid %}< div class ="ol-cover "> < a href ="{{ c.url }} "> {{ c.title | markdownify | strip_html }}< img src ="https://buddhistuniversity.net/assets/imgs/covers/ {{ c.olid }}.jpg " alt ="{{ c.title }} "> </ a > </ div > {% else %}
1010 < div class ="content_title "> {% capture foo %}{% include simple_content_title.html content=c %}{% endcapture %}{{ foo | strip_newlines }}</ div > {% endif %}
1111 < div class ="star_label "> {% unless c.stars == 3 %}< span class ="RatingLabel-{{ c.stars }} "> {% include starlabel.html stars=c.stars %}</ span > {% endunless %}</ div >
1212 {% unless c.olid %}{% assign supex = false %}{% if c.external_url contains 'youtu' %}{% unless c.external_url contains "list" %}
Original file line number Diff line number Diff line change 2424 < script > window . topic_category = "{{ page.course | default: 'archive' }}" ; </ script >
2525 < div class ="back "> < a href ="/content/ "> Content</ a > / < a href ="/content/{{ page.category }}/ "> {{ category.title }}</ a > /</ div >
2626 {% if page.olid %}
27- < img src ="https://covers.openlibrary.org/b/olid/ {{ page.olid }}-L .jpg?default=false " alt ="the book cover ">
27+ < img src ="https://buddhistuniversity.net/assets/imgs/covers/ {{ page.olid }}.jpg " alt ="the book cover ">
2828 {% endif %}
2929 {% assign title = page.title | markdownify | remove: '< p > ' | remove: '</ p > ' | split: ": " %}
3030 < h1 class ="post-title "> {% if page.subcat %}{% include content_icon.html category=page.category subcat=page.subcat %} {% endif %}{{ title | first }}
Original file line number Diff line number Diff line change 1111 BOOKCOVER_DIR .mkdir ()
1212
1313def download_cover (olid ):
14- response = requests .get (f"https://covers.openlibrary.org/b/olid/{ olid } -L.jpg?default=false" )
15- assert response .status_code == 200
16- with open (BOOKCOVER_DIR .joinpath (f"{ olid } .jpg" ), "wb" ) as f :
17- f .write (response .content )
14+ retries = 0
15+ while retries < 4 :
16+ if retries > 0 :
17+ print (" Retrying..." )
18+ try :
19+ response = requests .get (
20+ f"https://covers.openlibrary.org/b/olid/{ olid } -L.jpg?default=false" ,
21+ timeout = 15 ,
22+ allow_redirects = True ,
23+ )
24+ if response .status_code == 200 and response .content :
25+ with open (BOOKCOVER_DIR .joinpath (f"{ olid } .jpg" ), "wb" ) as f :
26+ f .write (response .content )
27+ return True
28+ else :
29+ print (f" Failed to download with status { response .status_code } " )
30+ except requests .exceptions .RequestException as e :
31+ print (f" Failed to download with error { e } " )
32+ retries += 1
33+ raise RuntimeError (f"Failed to download { olid } 4 times" )
34+
1835
1936website .load ()
2037for page in website .content :
You can’t perform that action at this time.
0 commit comments