Watch page: add info box with allowed countries and tor exit node
Should help with debugging various content blocks
This commit is contained in:
parent
3f310bfc33
commit
9f090dbbf8
@ -137,6 +137,7 @@
|
|||||||
grid-row:8;
|
grid-row:8;
|
||||||
grid-column: 1 / span 2;
|
grid-column: 1 / span 2;
|
||||||
background-color: var(--interface-color);
|
background-color: var(--interface-color);
|
||||||
|
padding-bottom: 7px;
|
||||||
}
|
}
|
||||||
.music-list table,th,td{
|
.music-list table,th,td{
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
@ -150,6 +151,22 @@
|
|||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
margin-bottom:5px;
|
margin-bottom:5px;
|
||||||
}
|
}
|
||||||
|
.more-info{
|
||||||
|
grid-row: 9;
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
background-color: var(--interface-color);
|
||||||
|
}
|
||||||
|
.more-info > summary{
|
||||||
|
font-weight: normal;
|
||||||
|
border-width: 1px 0px;
|
||||||
|
border-style: solid;
|
||||||
|
}
|
||||||
|
.more-info-content{
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
.more-info-content p{
|
||||||
|
margin: 8px 0px;
|
||||||
|
}
|
||||||
.comments-area-outer{
|
.comments-area-outer{
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
grid-row: 3;
|
grid-row: 3;
|
||||||
@ -316,6 +333,16 @@
|
|||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<details class="more-info">
|
||||||
|
<summary>More info</summary>
|
||||||
|
<div class="more-info-content">
|
||||||
|
<p>Tor exit node: {{ ip_address }}</p>
|
||||||
|
{% if invidious_used %}
|
||||||
|
<p>Used Invidious as fallback.</p>
|
||||||
|
{% endif %}
|
||||||
|
<p class="allowed-countries">Allowed countries: {{ allowed_countries|join(', ') }}</p>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if related_videos_mode != 0 %}
|
{% if related_videos_mode != 0 %}
|
||||||
|
@ -235,12 +235,14 @@ def extract_info(video_id):
|
|||||||
info['playability_error'] = decryption_error
|
info['playability_error'] = decryption_error
|
||||||
|
|
||||||
# check for 403
|
# check for 403
|
||||||
|
info['invidious_used'] = False
|
||||||
if settings.route_tor and info['formats'] and info['formats'][0]['url']:
|
if settings.route_tor and info['formats'] and info['formats'][0]['url']:
|
||||||
response = util.head(info['formats'][0]['url'],
|
response = util.head(info['formats'][0]['url'],
|
||||||
report_text='Checked for URL access')
|
report_text='Checked for URL access')
|
||||||
if response.status == 403:
|
if response.status == 403:
|
||||||
print(('Access denied (403) for video urls.'
|
print(('Access denied (403) for video urls.'
|
||||||
' Retrieving urls from Invidious...'))
|
' Retrieving urls from Invidious...'))
|
||||||
|
info['invidious_used'] = True
|
||||||
try:
|
try:
|
||||||
video_info = util.fetch_url(
|
video_info = util.fetch_url(
|
||||||
'https://invidio.us/api/v1/videos/'
|
'https://invidio.us/api/v1/videos/'
|
||||||
@ -418,6 +420,10 @@ def get_watch_page(video_id=None):
|
|||||||
limited_state = info['limited_state'],
|
limited_state = info['limited_state'],
|
||||||
age_restricted = info['age_restricted'],
|
age_restricted = info['age_restricted'],
|
||||||
playability_error = info['playability_error'],
|
playability_error = info['playability_error'],
|
||||||
|
|
||||||
|
allowed_countries = info['allowed_countries'],
|
||||||
|
ip_address = info['ip_address'] if settings.route_tor else None,
|
||||||
|
invidious_used = info['invidious_used'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,6 +318,14 @@ def _extract_formats(info, player_response):
|
|||||||
|
|
||||||
info['formats'].append(fmt)
|
info['formats'].append(fmt)
|
||||||
|
|
||||||
|
# get ip address
|
||||||
|
if info['formats']:
|
||||||
|
query_string = info['formats'][0].get('url', '?').split('?')[1]
|
||||||
|
info['ip_address'] = deep_get(
|
||||||
|
urllib.parse.parse_qs(query_string), 'ip', 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _extract_playability_error(info, player_response, error_prefix=''):
|
def _extract_playability_error(info, player_response, error_prefix=''):
|
||||||
if info['formats']:
|
if info['formats']:
|
||||||
info['playability_status'] = None
|
info['playability_status'] = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user