Giter VIP home page Giter VIP logo

Comments (12)

rajjys avatar rajjys commented on August 11, 2024 1

Thank you Mr. Igor and sorry for taking too much of your time. I've learned a lot from this conversation alone. Keep up the good work and stay safe.

from java-youtube-downloader.

sealedtx avatar sealedtx commented on August 11, 2024

before calling response.data() you should check if request was successful -response.ok()
if it returns false you can check what is returned by response.error()

you don't need API KEY, this library works as web scraper

from java-youtube-downloader.

rajjys avatar rajjys commented on August 11, 2024

response.ok() returns false and response.error() gives

"java.util.concurrent.ExecutionException: com.alibaba.fastjson2.JSONException: class java.lang.String cannot be converted to class java.lang.String"

from java-youtube-downloader.

sealedtx avatar sealedtx commented on August 11, 2024

class java.lang.String cannot be converted to class java.lang.String
seems very strange, may be you have some issues with java versions?

from java-youtube-downloader.

rajjys avatar rajjys commented on August 11, 2024

Which versions should i use? At the same time,
YoutubeVideoExtractor_Tests.java returns "getVideo should be successful for default videos without signature"
YoutubeDownloader_Tests returns: "download subtitles should work" as well as "download video should work"
Maybe its me that do not understand how this work

from java-youtube-downloader.

sealedtx avatar sealedtx commented on August 11, 2024

Java 8+ should works, but I mean maybe you have messed up classpath?
Also provide full stacktrace
response.error().printStackTrace()

from java-youtube-downloader.

rajjys avatar rajjys commented on August 11, 2024

`java.util.concurrent.ExecutionException: com.alibaba.fastjson2.JSONException:
class java.lang.String cannot be converted to class java.lang.String

at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at com.github.kiulian.downloader.downloader.response.ResponseImpl.error(ResponseImpl.java:96)
at MainClass.videoInfo(MainClass.java:70)
at MainClass.main(MainClass.java:46)

Caused by: com.alibaba.fastjson2.JSONException: class java.lang.String cannot be converted to class java.lang.String

at com.alibaba.fastjson.JSONArray.toJavaList(JSONArray.java:817)
at com.github.kiulian.downloader.model.videos.VideoDetails.<init>(VideoDetails.java:30)
at com.github.kiulian.downloader.parser.ParserImpl.parseVideoDetails(ParserImpl.java:182)
at com.github.kiulian.downloader.parser.ParserImpl.parseVideoAndroid(ParserImpl.java:104)
at com.github.kiulian.downloader.parser.ParserImpl.parseVideo(ParserImpl.java:63)
at com.github.kiulian.downloader.parser.ParserImpl.lambda$0(ParserImpl.java:49)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

`

from java-youtube-downloader.

sealedtx avatar sealedtx commented on August 11, 2024

check which version of com.alibaba.fastjson do you have in classpath

from java-youtube-downloader.

rajjys avatar rajjys commented on August 11, 2024

Yeah, like you pointed before, i had a problem with my classpath and the overall project configuration.
I reset everything and started from scratch, now it works fine.
Thank you for the amazing work.
Just one quick question before i close: if i have the googlevideo.com/videoplayback link from an API call and i just want to use this library for the download part, how do i proceed?

from java-youtube-downloader.

sealedtx avatar sealedtx commented on August 11, 2024

Not familiar with youtube API, what exactly link do you have? If it is direct link to video file you can simply copy code snippet responsible for downloading file.
Or you can manually create Format, fill it with your data, create RequestVideoFileDownload and call Downloader#downloadVideoAsFile

public ResponseImpl<File> downloadVideoAsFile(RequestVideoFileDownload request) {

from java-youtube-downloader.

rajjys avatar rajjys commented on August 11, 2024

Yeah and that's the question actually, i have not found a way to manually create a Format object with my desired data(url)
protected Format(JSONObject json, boolean isAdaptive, String clientVersion) is the only option i see but can't use.

ex: https://rr2---sn-ap90pquxaxjvh-3bae.googlevideo.com/videoplayback?expire=1657223644&ei=fOXGYq2_KI_XxwKOtIpI&ip=102.223.208.45&id=o-AOBVMm6U9AAvktoluvlYoDLhZN4ZEmuVKzWsA7T-EBdN&itag=22&source=youtube&requiressl=yes&mh=Bi&mm=31%2C29&mn=sn-ap90pquxaxjvh-3bae%2Csn-hc57enee&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=131250&vprv=1&mime=video%2Fmp4&cnr=14&ratebypass=yes&dur=101.517&lmt=1647898851406326&mt=1657201771&fvip=5&fexp=24001373%2C24007246&c=ANDROID&txp=6318224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRAIgZDLRT2KmeHbfZzJdSLOTRDLmyXf9ZIPajRdCuv31_vACICUliwDqh4N8LSDoIVgamYV2GedBdRoAbDHpbqo0WQSe&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgIL1vA3bSLVi2aUqU9uRE_w1N-IZGrM9zWlLa_l3FQdICIQCoLH7NRFT19BUI7WzryPv1xpCRQxRnvZ3BMPrmgR_LTA%3D%3D

which is basically what i got from it.url() in the code
But assume i got this link from another source, how do i create a Format object with it?

from java-youtube-downloader.

sealedtx avatar sealedtx commented on August 11, 2024

yes, indeed there is no constructor for such case
but you can create JSONObject json and populate it with required fields

from java-youtube-downloader.

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.