Comments (10)
Does anybody know on how to get peertube api? Or we can scrape the site just like youtube.
I think we can just scrape it.
Edit: Sepia search is a search engine for peertube, so I assume we can definitely scrape it like YouTube.
That being said I'd also like support for:
Maybe there can be a flag that brings up a menu that lists different video sources like YT, LBRY, etc. and when the user selects one of them, it presents a prompt where user enters search string and presses Enter
and then ytfzf
will behave just as it is now, but for the chosen site.
from ytfzf.
Yea flag will keep the logic modular for diff. websites. and also break less as new sites are added.
from ytfzf.
Actually, Sepia Search has a JSON API that can be used like this:
https://sepiasearch.org/api/v1/search/videos?search=stallman
I don't know where this is documented, but I found it in NewPipe’s code.
Edit: I was told that Sepia Search uses an empty PeerTube instance as a search backend. So the API is documented here.
from ytfzf.
Also invidious would be nice to be supported as an alternative source for youtube videos. It should work without javascript as well, so getting the results should be fairly simple.
from ytfzf.
Noted. We will add this to the TODO's and add sites one by one
from ytfzf.
wow, nice, I will be trying to implement this.
from ytfzf.
Sounds interesting, just found out that you can play peertube videos with mpv and ytdl. I will need to go throught the peertube api.
Does anybody know on how to get peertube api? Or we can scrape the site just like youtube.
from ytfzf.
The current script relies on the json file from youtube's search result page.
A browser would run the javascript and render the search results.
ytfzf
scrapes the contents of the java script's json, and instead of running any java script, it uses jq
to parse the json object and render the video results.
from ytfzf.
I just had a few minutes to think about this an wrote a few lines to produce videos_json
data like in Ytfzf's code but for Sepia Search instead of YouTube.
# query string for testing
search_query="Hello World"
scrape_pt() {
#gets a list of videos
videos_json=$(
curl \
-s "https://sepiasearch.org/api/v1/search/videos" \
-G --data-urlencode "search=$*" |
jq '[ .data | .[] |
{
title: .name,
channel: .channel.displayName,
duration: .duration,
views: .views,
date: .publishedAt,
videoID: .uuid,
thumbs: .thumbnailUrl
}
]')
}
scrape_pt "$search_query"
# print first three entries
printf "%s" "$videos_json" | jq '[.[]][:3]'
The output of the above looks like this:
[
{
"title": "Hello World",
"channel": "Main requiem channel",
"duration": 58,
"views": 7,
"date": "2019-12-30T18:12:19.662Z",
"videoID": "e3fbacb5-2add-4f45-8bec-7ee565dddc8f",
"thumbs": "https://video.hackers.town/static/thumbnails/e3fbacb5-2add-4f45-8bec-7ee565dddc8f.jpg"
},
{
"title": "Hello World",
"channel": "Main programmingfish channel",
"duration": 6,
"views": 16,
"date": "2019-07-07T13:26:01.663Z",
"videoID": "7cf70066-7775-4d2f-a9c2-44c83fd73955",
"thumbs": "https://tube.piweb.be/static/thumbnails/7cf70066-7775-4d2f-a9c2-44c83fd73955.jpg"
},
{
"title": "4- Hello World",
"channel": "LearnAsYouLike",
"duration": 325,
"views": 0,
"date": "2020-11-15T04:00:21.357Z",
"videoID": "a2576ad6-1efb-4f06-917b-b32bc3f44fdf",
"thumbs": "https://diode.zone/static/thumbnails/a2576ad6-1efb-4f06-917b-b32bc3f44fdf.jpg"
}
]
from ytfzf.
Thanks to @Euro20179 this has been implemented in #281 (not yet merged to master,
to use development branch ytfzf --update-unstable
)
Search peertube with -P
flag
from ytfzf.
Related Issues (20)
- [BUG]: [ERROR]: Nothing was scraped HOT 4
- Using submenus HOT 2
- strange bug overwriting and repeat text on top of first text HOT 8
- [Feature request]: interactively change the sort order HOT 2
- [BUG]: Misaligned description items on start with --preview-side=bottom HOT 2
- [Feature request]: Enable external thumbnails without info pane in fzf or preserve thumbnail viewer window HOT 2
- [BUG]: Broken character encoding when using the yt-music scraper HOT 11
- [BUG]: socat, and mpv must be installed for the mpv thumbnail viewer
- [BUG]: mpv installed with flatpak is not recognized HOT 3
- [BUG]: thumbnails won't load when requesting more pages HOT 2
- [BUG]: shift `-1` is not a valid option HOT 1
- [BUG]: using nonalphanumeric characters in optstring produces unspecified results HOT 2
- [Feature request]: shuffle playlist HOT 4
- How do I change the default quality of the videos? HOT 2
- [Feature request]: YouTube Podcast
- how to show the video thumbnail imae on the terminal HOT 1
- how to play only audio using elisa music player
- Subscriptions are not working on OpenBSD HOT 1
- [BUG]: ERROR: Nothing was scraped no matter which instance I use HOT 4
- [BUG]: Unable to extract uploader id; HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ytfzf.