Giter VIP home page Giter VIP logo

Comments (22)

Sdarfeesh avatar Sdarfeesh commented on May 20, 2024 2

In the latest debug version, The download speed was improved, but only works for <10min songs, it's still slow to download the songs which are longer than 10min

screen-20230624-124151.mp4

from innertune.

Theta-Dev avatar Theta-Dev commented on May 20, 2024 1

The slow download speed is caused by YouTube's throttling.

If you want to download YouTube streams at full speed, you have to make it look like you are streaming. Download the file in chunks with a maximum size of 10MB and specify the chunk size either using the Range header or the &range=0-10000000 url parameter.

If you use the Range header, YouTube will send you a Content-Range header back, from which you can extract the total file size and figure out, how many more chunks need to be downloaded.

If you are using the URL parameter method (which is used by the YouTube web player), you need to know the total file size beforehand. It can be extracted from YouTube's player response and it is included in the stream URL as well (clen parameter).

You can use concurrent connections to download multiple chunks at a time, but that is optional. Most music tracks are smaller than 10MB anyway, so they can be downloaded in just 1 chunk.

Adding a bit of randomness to the chunk size is good style, yt-dlp does it too, but I dont know if it is really necessary.

from innertune.

z-huang avatar z-huang commented on May 20, 2024

The song is saved in the app-specific external files directory. You'll see them in (/Android/data/com.zionhuang.music/files/media), and the filename is the hash of the song id. How users can receive the files are in the roadmap. Possibly providing a share option in the three-dots song menu and implementing a DocumentProvider. Some ideas are mentioned in #3.

The app uses Android DownloadManager to download files. I also experienced a slow download speed. It shouldn't be that slow, but there seems to be no method to tweak that. I'll implement a custom downloader instead. It should be faster.

from innertune.

ArjixWasTaken avatar ArjixWasTaken commented on May 20, 2024

I might make a PR for this soon

Oh yeah, thank you for this app, it is exactly what I wanted, I had been planning to make an app like this but I then discovered your app.

Much thanks!

from innertune.

z-huang avatar z-huang commented on May 20, 2024

Have you try the debug APK in feature/innertube branch? Things has changed a lot.

from innertune.

ArjixWasTaken avatar ArjixWasTaken commented on May 20, 2024

I haven't taken a look at the code/branches yet, so no

From your reply I guess the downloads are faster now? Great

from innertune.

z-huang avatar z-huang commented on May 20, 2024

From your reply I guess the downloads are faster now?

No, I haven't fixed.

from innertune.

lovelilke avatar lovelilke commented on May 20, 2024

From your reply I guess the downloads are faster now?

No, I haven't fixed.

How about this library https://github.com/lingochamp/FileDownloader

from innertune.

ArjixWasTaken avatar ArjixWasTaken commented on May 20, 2024

Or https://github.com/LagradOst/Aria2cButton

A friend made it so I couldn't hold back and not share it.

It uses aria2 to do the downloads.
And you may already know, but aria2 is super fast.

from innertune.

z-huang avatar z-huang commented on May 20, 2024

I haven't spent time on this, so I can't say too much. Maybe eventually I need to write my own library for it, which will take massive time. However, I don't prefer aria2 because it is a command line tool and needs a wrapper to make it a java library.

from innertune.

ArjixWasTaken avatar ArjixWasTaken commented on May 20, 2024

I haven't spent time on this, so I can't say too much. Maybe eventually I need to write my own library for it, which will take massive time. However, I don't prefer aria2 because it is a command line tool and needs a wrapper to make it a java library.

Yes, I sent a library that wraps the json rpc aria has.

from innertune.

z-huang avatar z-huang commented on May 20, 2024

I mean the interface may not be rich. Say, it doesn't support proxy.

from innertune.

ArjixWasTaken avatar ArjixWasTaken commented on May 20, 2024

aria2's json rpc has everything accessible via the CLI and much more

Extending the wrapper to support proxies won't be that hard.

from innertune.

z-huang avatar z-huang commented on May 20, 2024

I don't think so. In short, it lacks flexibility.

from innertune.

ArjixWasTaken avatar ArjixWasTaken commented on May 20, 2024

What?

How does it lack flexibility?
And if you can't be arsed to read the code in order to add proxy support, here are the two places you need to modify so you can use proxies with aria2: AbstractClient.kt#L366-L395 and
Aria2Classes.kt#L36-L106

from innertune.

z-huang avatar z-huang commented on May 20, 2024

Then I'll use other libraries or write one for my own instead. Communicating with a layer of json rpc just looks ugly for me. Also, the file size of a song is roughly 3~5MB. We don't really need a super fast downloader.

from innertune.

ArjixWasTaken avatar ArjixWasTaken commented on May 20, 2024

Then I'll use other libraries or write one for my own instead. Communicating with a layer of json rpc just looks ugly for me. Also, the file size of a song is roughly 3~5MB. We don't really need a super fast downloader.

The current downloader is capped at 80kb/s, I don't know why, might be because it is using a single connection for each download

The fact is that you will die if you want to download your entire library...and a fast downloader is a must

from innertune.

mosestyle avatar mosestyle commented on May 20, 2024

@Theta-Dev Is there a way to somehow speed up the download speed or bypass the throttling somehow? 🤔

from innertune.

RandomModderJDK avatar RandomModderJDK commented on May 20, 2024

Also you can add to the auto download feature, that it only downloads when wifi is available

from innertune.

Sdarfeesh avatar Sdarfeesh commented on May 20, 2024

@Theta-Dev Is there a way to somehow speed up the download speed or bypass the throttling somehow? 🤔

Found a way to do speed up

  1. Download any song
  2. Pause the download in notification
  3. Resume it
  4. Download is faster than before (2 MB/s for me)
    This is working for me, I'm not sure is it work for th others, but you can try to reproduce it

from innertune.

Sdarfeesh avatar Sdarfeesh commented on May 20, 2024

@Theta-Dev Is there a way to somehow speed up the download speed or bypass the throttling somehow? 🤔

Found a way to do speed up

  1. Download any song
  2. Pause the download in notification
  3. Resume it
  4. Download is faster than before (2 MB/s for me)
    This is working for me, I'm not sure is it work for th others, but you can try to reproduce it
ScreenRecord-20230217-204210.mp4

from innertune.

sami155 avatar sami155 commented on May 20, 2024

@Theta-Dev Is there a way to somehow speed up the download speed or bypass the throttling somehow? 🤔

Found a way to do speed up

  1. Download any song
  2. Pause the download in notification
  3. Resume it
  4. Download is faster than before (2 MB/s for me)
    This is working for me, I'm not sure is it work for th others, but you can try to reproduce it
ScreenRecord-20230217-204210.mp4

I don't have the option to pause the downloads

from innertune.

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.