Skip to content

Commit de15cb4

Browse files
committed
Github gist does not block rendering now
1 parent 5a906ad commit de15cb4

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.github/workflows/static.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
109109
DATABASE_URL: ${{ secrets.DATABASE_URL }}
110110
SYSLOG_ADDRESS: ${{ secrets.SYSLOG_ADDRESS }}
111-
if: ${{ endswith(github.run_id, '3') || endswith(github.run_id, '6') || endswith(github.run_id, '9') }}
111+
if: ${{ github.event_name == 'push' || endswith(github.run_id, '3') || endswith(github.run_id, '6') || endswith(github.run_id, '9') }}
112112

113113
- name: Generate Home Page
114114
run: make gh_home_page

page_content_extractor/embeddable.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,6 @@ def gist_github_com_parser(self, url):
116116
path = urlsplit(url).path
117117
if path.count('/') < 2:
118118
raise ParseError('Invalid gist.github.com embeddable url(%s)' % url)
119-
return '<script src="https://gist.github.com%s.js"></script>' % path
119+
# See https://milanaryal.com.np/how-to-embed-github-gists-in-an-iframe-tag/
120+
return f'<iframe src="https://gist.github.com{path}.pibb" style="width: 100%; height: 250px; border: 0;"></iframe>'
121+
# return '<script src="https://gist.github.com%s.js"></script>' % path

page_content_extractor/http.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class CustomHTTPAdapter(HTTPAdapter):
16-
timeout = timeout.Timeout(connect=2, read=20)
16+
timeout = timeout.Timeout(connect=10, read=30)
1717

1818
def __init__(self, *args, **kwargs):
1919
if "max_retries" not in kwargs:

requirements.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ requests==2.31.0
1010
mock==5.1.0
1111
werkzeug==2.3.7
1212
feedwerk==1.1.0
13-
Pillow==10.0.0
13+
Pillow==10.0.1
1414
fake-useragent==1.2.1
1515
olefile
16-
openai==0.28.0
17-
torch==2.0.1
16+
openai==0.28.1
17+
torch==2.1.0
1818
bert-extractive-summarizer==0.10.1
19-
transformers==4.31.0
19+
transformers==4.34.0
2020
python-dotenv==1.0.0
2121
python_slugify==8.0.1
22-
sqlalchemy==2.0.20
23-
psycopg2==2.9.7
22+
sqlalchemy==2.0.21
23+
psycopg2==2.9.9
2424
humanize==4.8.0
25-
llama-cpp-python==0.2.5
25+
llama-cpp-python==0.2.11
2626
tiktoken==0.5.1

test/test_embeddable_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ def test_pdf_yt_parser(self):
6969
def test_gist_github_com(self):
7070
parser = EmbeddableExtractor('<html></html>', 'https://gist.github.com/polyrabbit/5693787')
7171
self.assertEqual(parser.get_content(),
72-
'<script src="https://gist.github.com/polyrabbit/5693787.js"></script>')
72+
'<iframe src="https://gist.github.com/polyrabbit/5693787.pibb" style="width: 100%; height: 250px; border: 0;"></iframe>')
7373
self.assertRaises(ParseError, EmbeddableExtractor, 'whatever', 'https://gist.github.com/')

0 commit comments

Comments
 (0)