Giter Club home page Giter Club logo

Comments (8)

dotX12 avatar dotX12 commented on June 18, 2024

@SetUpSim, Hello!

I have a question for you:
If you are using the Telebot library, why are you sending a naked request to API telegram, this library already has methods for downloading files.

I already have a project that you want to implement:
https://github.com/dotX12/ShazamBot

An asynchronous library for working with telegram is used here (aiogram).

from shazamio.

SetUpSim avatar SetUpSim commented on June 18, 2024

A piece of Telebot documentation:

# getFile
# Downloading a file is straightforward
# Returns a File object
import requests
file_info = tb.get_file(file_id)

file = requests.get('https://api.telegram.org/file/bot{0}/{1}'.format(API_TOKEN, file_info.file_path))

So I'm sending a naked request to Telegram API to download files because Telebot appears to have no API method for doing this.
Thank you for your advice on aiogram, but I'm currently mastering another library. And here a strange bug reveals, so I would like you to maybe clear the things out for me.

from shazamio.

dotX12 avatar dotX12 commented on June 18, 2024

@SetUpSim,
In fact, I changed almost nothing, your code worked for me, only changed the launch of an asynchronous function in a loop.
https://carbon.now.sh/qH4Jci9HPh2uboq9tNDz

image

from shazamio.

dotX12 avatar dotX12 commented on June 18, 2024

Console:

image

File hierarchy:

image

from shazamio.

SetUpSim avatar SetUpSim commented on June 18, 2024

@dotX12 Your code still raises FileNotFoundError for me.
What's your Python version? Mine is 3.9.0

from shazamio.

dotX12 avatar dotX12 commented on June 18, 2024

Check if your files are saved?
If so, maybe they will be saved to a different location, relative to your bot file.

from shazamio.

dotX12 avatar dotX12 commented on June 18, 2024

@SetUpSim, Ahhh, sorry man...

RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
  

You need to install ffmpeg.

from shazamio.

SetUpSim avatar SetUpSim commented on June 18, 2024

Yep, that was the thing. Thank you

from shazamio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.