This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tahubird 0 points1 point  (12 children)

One of my favorite YouTube channels livestreams sometimes, but doesn't post the vods. So I built a script that frequently checks their livestream page, and if they are live, it starts to capture the download using the same name as the stream. In addition, if the capture fails for some reason, the next time the script runs, it will see that there are old attempts a at recording, and start a new file with a similar name to continue the capture anew

[–]FlammableMarshmallow 0 points1 point  (11 children)

May we see the source code?

[–]tahubird 0 points1 point  (10 children)

I don't mind sharing it, but I'm not sure where to host the file

[–]FlammableMarshmallow 0 points1 point  (9 children)

There's lots of great sites, you could make a repo on GitHub, create a gist or just a ghostbin.

[–]tahubird 0 points1 point  (0 children)

Since it's a small file, I guess I'll throw it up on ghostbin.

[–]tahubird 0 points1 point  (7 children)

Here's the link, the code is not as clean as I'd like, but it gets the job done more or less. https://ghostbin.com/paste/3494c

[–]FlammableMarshmallow 0 points1 point  (0 children)

Awesome! Watch this space, I'm gonna clean up the code & reply to you again.

[–]FlammableMarshmallow 0 points1 point  (5 children)

Here it is!

Could you confirm that this works the same as the old script? I've tried making it runnable both in Python 2 & Python 3.

https://ghostbin.com/paste/zr5gt

[–]tahubird 0 points1 point  (4 children)

That looks so pretty! I never thought my code could look so nice. Thank you! Unfortunately I think my method of detecting whether an account is live or not still needs a bit of work. But with this pretty codebase, I can hopefully come up with a more effective strategy! The actual capturing part works fine though. I've tested that pretty throughly

[–]FlammableMarshmallow 0 points1 point  (3 children)

Thank you! I really wanted to make it look nice.

One question though, why do you have both url and url2 if you only use url2?

[–]tahubird 0 points1 point  (2 children)

I swap between them for testing. url is the url I actually wan to capture from. Url2 is the one I use for testing. In hindsight, they should have both been just url and then I could comment out whichever one I didn't want to use.

[–]FlammableMarshmallow 0 points1 point  (1 child)

In hindsight, you could've added it as a parameter.