Giter VIP home page Giter VIP logo

view-youtube-dislike's People

Contributors

jesperbakhandskemager avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

view-youtube-dislike's Issues

App stops systematically

App version: 1.1.0 (from F-Droid)
OS: Android 10
Device: Samsung Galaxy A31
I will do my best to answer further questions.

Add title field in dislikes view

Hello,
I'm a hobby "plain" java developer. A few months ago I saw the app in the F-droid store and it sounded interesting, so I tried it out. Since then, I've been using the app to look how many dislikes some really bad videos had and sometimes to share them with friends.
One thing that is, in my opinion, still missing in the app is a field to show the title of the video in the dislikes view. So if you, for example, take a screenshot of the app to share it with friends, they can directly see what video is it about.
After a little bit of research I found out, that the API at youtube.com/oembed is able to return some information about the video, including the title. Using https://youtube.com/oembed?format=json&url=[URL of the youtube video here] the data is returned as a JSON string.
The following code snippet in normal java demonstrates the use of this API:

	public static String getYoutubeVideoTitle(String url)
			throws InterruptedException, URISyntaxException, IOException, ParseException {
		url = "https://youtube.com/oembed?format=json&url=" + url;

		// Request
		BodySubscriber<String> subscriber = BodySubscribers.ofString(Charset.defaultCharset());
		HttpRequest request = HttpRequest.newBuilder(new URI(url)).GET().build();
		HttpClient client = HttpClient.newHttpClient();
		String response = client.send(request, (responeInfo) -> subscriber).body();

		// JSON parsing
		JSONObject json = (JSONObject) new JSONParser().parse(new StringReader(response));
		response = (String) json.get("title");

		return response;
	}

Since I'm not a android developer and my computer is to old to run android studio, I can't test this on android, but it tested it on my computer using the json-simple library and it worked as expected (Both youtube.com and youtu.be URLs).
To port it to android, my best guess is to change the request part to StringRequest, as used in app/src/main/java/com/jesperh/showyoutubedislikes/DisplayMessageActivity.java, line 126 and to parse the JSON using builtin android functions.
Thanks for making this app!

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.