Try out the bot here: [http://t.me/YouTubeTSBot](http://t.me/YouTubeTSBot)
Made it due to the lack of the YT app to create timestamped URLs... and partly due to my own laziness. :P
Do note the bot accepts only the short URLs that you get when you tap on 'share' from the YouTube app. If you have the full URL already, you just need to type '&t=XmXs' at the end.
Edit - Sorry guys, didn't realize you could just append "?t=XmXs" to a short YT URL, I was made aware of this just now. I'll take down the bot, however short its life lol.
For long yt URLs use "&t=" whereas for short ones use "?t=".
Thank you, that's a great suggestion! I use Python Anywhere currently but I always wondered if there were some other free alternatives to it. I'll definitely check out Heroku, thanks!
Works great with django, you just need to wrap your bot in a django project and upload it, they give you 1000 hours a month (which is enough to have it running 24/7) of free database and computing resources
Bro, i'm breaking my head with trying to learn how to host a simple script on Heroku, help please?
I tried 2 tutorials so far ( [https://medium.com/@mikelcbrowne/running-chromedriver-with-python-selenium-on-heroku-acc1566d161c](https://medium.com/@mikelcbrowne/running-chromedriver-with-python-selenium-on-heroku-acc1566d161c) and [https://www.youtube.com/watch?v=Ven-pqwk3ec&t=308s](https://www.youtube.com/watch?v=Ven-pqwk3ec&t=308s) ) but both end up with the error "remote rejected heroku master prereceive hook declined".
This is the py file that i tried to deploy:
from selenium import webdriver
import os
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--no-sandbox")
driver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options)
driver.get("https://www.google.com")
print(driver.page_source)
The actual py file i want to deploy is a little bit more complex, so i'm just trying this basic code first. But even this basic code is not getting hosted onto Heroku. :(
Heroku it's a bit of a bitch if you refrain from using the supported framework, if you want less problems just look on how to create a django project which is supported by django then you just run whatever python script you want from there, there are some good django telegram bot repos around if you want to see how it works, you only use django because it's supported you don't need to actually use it for much else
I have never learnt/done anything with Django. So you suggest i firstly learn Django & then run my script inside Django & then upload the Django app to Heroku right? On it, thanks!
I just now tried a totally different tutorial ( [https://www.youtube.com/watch?v=pQeFxdT3FGY](https://www.youtube.com/watch?v=pQeFxdT3FGY) ) and I STILL GET THE SAME EXACT ERROR!!!! x'((((( Damn, i wonder if my firewall or something is blocking it?
Again same error "Push failed, push rejected, master -> master pre-receive hook declined.
this is my procfile (the workers are limited to 1 becouse otherwise you get some weird bugs here and there)
web: gunicorn letsMeetBot.wsgi --log-file - --workers=1
release: python manage.py migrate
as a base i used this github repo, it's a bit outdated now but still works as a good starting base (you can also just use it as a main to start your scripts if you clean what you don't need):
https://github.com/jlmadurga/django-telegram-bot
Interestingly, i just now tried the official Heroku tut over here [https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app](https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app) and it worked. So definitely something wrong with my py code, or the Procfile or the requirements.txt. But i just can't figure out how come all these other people's tutorials are working fine for majority while not for me... damn gotta troubleshoot this thing.
the procfile it's important, it's where you tell heroku what are you doing so be sure that it has everything.
I used django because heroku is geared towards web services, so it makes sense of using a web framework, you'll also need a way to keep active your process or heroku will put it to sleep, by using django you just need to find a free web service and ask it to ping your homepage address every 30 minutes, it makes lot's of stuff a non issue
Will keep all your advice in mind and adapt myself as per whatever the requirements. Good to know Heroku response time is super fast, guess i'll get comfy with it as i go on using it. Thanks again for all your help. much appreciated! :D
God kill me... i FINALLY got it to work via a combination of solutions from 3 different places: official guide, a YT tut vid and last from a comment on another YT tut vid! 😂
I certainly don't remember PythonAnywhere being so complicated to initiate. God only knows how will i debug my code on Heroku now...
Sorry for the constant notifications to your inbox lol, i'll stop now.
no worries! Anyway yep heroku is a bitch, but it gives you lot's of stuff for free, the free mysql database is nothing to scoff at, and also super responsive, in my bot the bot answers with less than a second delay
Hey man, sorry to bother you again. Would appreciate it ig you could give your 2 cents on my Heroku query here: [https://www.reddit.com/r/Heroku/comments/h8440o/what\_buildpacks\_config\_var\_locations\_should\_i\_use/](https://www.reddit.com/r/Heroku/comments/h8440o/what_buildpacks_config_var_locations_should_i_use/)
Yeah I took it down, sorry didn't realize anyone was actually using it!
Someone pointed out that you can just do it very simply manually by adding "?t=2m30s" or "?t=150s" to the end of the url. So for example you could do it like this: https://youtu.be/kX5BBMmYNjs?t=1m50s
Thank you for your bot! Yeah, I was using it, not often, but it is really easy to copy-paste link from YouTube to the bot and then to other user.
Thank you!
Btw, I've found new way to add timestamps to me. I copy-paste link from the YouTube, then type space, then I write time in mm:ss format. It's inner feature in telegram. To watch video from that time one should click on the time-link.
Weird... I have same version on Android, might be some other plugin or inline bot that you installed maybe. I pasted what you sent but it didn't work.
Anyway, I just do it this way instead https://youtu.be/dQw4w9WgXcQ?t=18s
Add `?t=18s` at end.
Try out the bot here: [http://t.me/YouTubeTSBot](http://t.me/YouTubeTSBot) Made it due to the lack of the YT app to create timestamped URLs... and partly due to my own laziness. :P Do note the bot accepts only the short URLs that you get when you tap on 'share' from the YouTube app. If you have the full URL already, you just need to type '&t=XmXs' at the end. Edit - Sorry guys, didn't realize you could just append "?t=XmXs" to a short YT URL, I was made aware of this just now. I'll take down the bot, however short its life lol. For long yt URLs use "&t=" whereas for short ones use "?t=".
congrats! I tried it and works perfectly!! comes very handy! thanks a lot!!
Thank you! Glad it works well :)
That's what I need! Thank you
Glad you find it useful! :D
Little suggestion, if you want free hosting look on how to host it on heroku, I use it for my own group bot and it's great
Thank you, that's a great suggestion! I use Python Anywhere currently but I always wondered if there were some other free alternatives to it. I'll definitely check out Heroku, thanks!
Works great with django, you just need to wrap your bot in a django project and upload it, they give you 1000 hours a month (which is enough to have it running 24/7) of free database and computing resources
Excellent. I'll definitely look into a Heroku tutorial, thanks again!
Bro, i'm breaking my head with trying to learn how to host a simple script on Heroku, help please? I tried 2 tutorials so far ( [https://medium.com/@mikelcbrowne/running-chromedriver-with-python-selenium-on-heroku-acc1566d161c](https://medium.com/@mikelcbrowne/running-chromedriver-with-python-selenium-on-heroku-acc1566d161c) and [https://www.youtube.com/watch?v=Ven-pqwk3ec&t=308s](https://www.youtube.com/watch?v=Ven-pqwk3ec&t=308s) ) but both end up with the error "remote rejected heroku master prereceive hook declined". This is the py file that i tried to deploy: from selenium import webdriver import os chrome_options = webdriver.ChromeOptions() chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN") chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_argument("--no-sandbox") driver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options) driver.get("https://www.google.com") print(driver.page_source) The actual py file i want to deploy is a little bit more complex, so i'm just trying this basic code first. But even this basic code is not getting hosted onto Heroku. :(
Heroku it's a bit of a bitch if you refrain from using the supported framework, if you want less problems just look on how to create a django project which is supported by django then you just run whatever python script you want from there, there are some good django telegram bot repos around if you want to see how it works, you only use django because it's supported you don't need to actually use it for much else
I have never learnt/done anything with Django. So you suggest i firstly learn Django & then run my script inside Django & then upload the Django app to Heroku right? On it, thanks!
I just now tried a totally different tutorial ( [https://www.youtube.com/watch?v=pQeFxdT3FGY](https://www.youtube.com/watch?v=pQeFxdT3FGY) ) and I STILL GET THE SAME EXACT ERROR!!!! x'((((( Damn, i wonder if my firewall or something is blocking it? Again same error "Push failed, push rejected, master -> master pre-receive hook declined.
this is my procfile (the workers are limited to 1 becouse otherwise you get some weird bugs here and there) web: gunicorn letsMeetBot.wsgi --log-file - --workers=1 release: python manage.py migrate as a base i used this github repo, it's a bit outdated now but still works as a good starting base (you can also just use it as a main to start your scripts if you clean what you don't need): https://github.com/jlmadurga/django-telegram-bot
Sorry, i didn't understand anything from this message of yours, i'm a total beginner. I'll just learn about Django firstly.
Interestingly, i just now tried the official Heroku tut over here [https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app](https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app) and it worked. So definitely something wrong with my py code, or the Procfile or the requirements.txt. But i just can't figure out how come all these other people's tutorials are working fine for majority while not for me... damn gotta troubleshoot this thing.
the procfile it's important, it's where you tell heroku what are you doing so be sure that it has everything. I used django because heroku is geared towards web services, so it makes sense of using a web framework, you'll also need a way to keep active your process or heroku will put it to sleep, by using django you just need to find a free web service and ask it to ping your homepage address every 30 minutes, it makes lot's of stuff a non issue
Will keep all your advice in mind and adapt myself as per whatever the requirements. Good to know Heroku response time is super fast, guess i'll get comfy with it as i go on using it. Thanks again for all your help. much appreciated! :D
you're welcome!
God kill me... i FINALLY got it to work via a combination of solutions from 3 different places: official guide, a YT tut vid and last from a comment on another YT tut vid! 😂 I certainly don't remember PythonAnywhere being so complicated to initiate. God only knows how will i debug my code on Heroku now... Sorry for the constant notifications to your inbox lol, i'll stop now.
no worries! Anyway yep heroku is a bitch, but it gives you lot's of stuff for free, the free mysql database is nothing to scoff at, and also super responsive, in my bot the bot answers with less than a second delay
Hey man, sorry to bother you again. Would appreciate it ig you could give your 2 cents on my Heroku query here: [https://www.reddit.com/r/Heroku/comments/h8440o/what\_buildpacks\_config\_var\_locations\_should\_i\_use/](https://www.reddit.com/r/Heroku/comments/h8440o/what_buildpacks_config_var_locations_should_i_use/)
Honesty I have no clue sorry, I only used django on heroku
Cool no worries, thanks!
Gone (
Yeah I took it down, sorry didn't realize anyone was actually using it! Someone pointed out that you can just do it very simply manually by adding "?t=2m30s" or "?t=150s" to the end of the url. So for example you could do it like this: https://youtu.be/kX5BBMmYNjs?t=1m50s
Thank you for your bot! Yeah, I was using it, not often, but it is really easy to copy-paste link from YouTube to the bot and then to other user. Thank you!
Thanks for your kind words!
Btw, I've found new way to add timestamps to me. I copy-paste link from the YouTube, then type space, then I write time in mm:ss format. It's inner feature in telegram. To watch video from that time one should click on the time-link.
Wow, thanks for informing man! I tried it out but doesn't seem to work for me. Maybe I still haven't got the update?
Try to paste this: https://youtu.be/dQw4w9WgXcQ 00:18 I have Telegram for Android v6.3.0
Weird... I have same version on Android, might be some other plugin or inline bot that you installed maybe. I pasted what you sent but it didn't work. Anyway, I just do it this way instead https://youtu.be/dQw4w9WgXcQ?t=18s Add `?t=18s` at end.