balvinderz / animewatcher

The goal of this project/app is to let the user watch anime without ads. It uses Jsoup to extract data from the website and Exoplayer to show videos.
85 stars 20 forks source link

Download option is not working #2

Closed Devilemox closed 4 years ago

Devilemox commented 5 years ago

Describe the bug download option doesn't work for any of the server, nothing happens when we select the download button.

i think there should be a webview or a pop up window to make it work

by the way im using

balvinderz commented 5 years ago

I have not completed the Download function yet . So it is not working . Will work on the download button after some time .

Devilemox commented 5 years ago

Thanks and by the way loved your work 😊

balvinderz commented 5 years ago

Thank You 😊

kiloma commented 5 years ago

Sadly, All the thumbnails Are gone, only the anime name shows, but the Anime image is not loaded ? Any Help please ?

Devilemox commented 5 years ago

When i check it out Gogoanime (*official site) doesnt had the images too. so i thought it was an temporary error but now they have all the images but it didn't load up on the app.

Can you Fix this?? @balvinderz

balvinderz commented 5 years ago

I fixed the thumbnail issue. https://www19.gogoanimes.tv/ was having some image issues . Thats why the images were not showing in the app . You can download the latest apk from here. Can you guys suggest some ui changes.

balvinderz commented 5 years ago

Clean the cache and data after installing the latest APK.

kiloma commented 5 years ago

I'm using the old version without the bottom_navigation with the ViewPager. What can i change so the images load in (Recent + Dub + Sub) fragments ?

Note : i think the ViewPager version is better looking.

kiloma commented 5 years ago

Is there Gonna be any problem or App crashes if i use Min Api 16 instead of 21 ?

balvinderz commented 5 years ago

if u are going to build your own apk , then change every https://www17.gogoanimes.tv/ to https://www4.gogoanime.io/ and replace the animelist.json to the current one. for the api 16 one , i will check and tell you .

balvinderz commented 5 years ago

and replace this line( It is in MainActivity.java). String imagelink = li.select("div[class=img]").eq(2*i).select("img").attr("src"); with String imagelink = li.select("div[class=img]").eq(i).select("img").attr("src");

kiloma commented 5 years ago

I changed the urls:

  static String   new_url = "https://www4.gogoanime.io/";
  ////  static String   old_url = "https://www17.gogoanimes.tv/";

but when i test the app with new_url while scrolling , it craches and the log

java.lang.IllegalArgumentException: Path must not be empty. at com.squareup.picasso.Picasso.load(Picasso.java:332) at com.stuffbox.webscraper.DataAdapter.onBindViewHolder(DataAdapter.java:78) at com.stuffbox.webscraper.DataAdapter.onBindViewHolder(DataAdapter.java:22)

i tried to add error bg image like this :
Picasso.get().load(mImageLink.get(position)).error(R.mipmap.ic_launcher).into(holder.imageofanime);

but it also crashes.

By the way, i don't have that String imagelink = li.select("div[class=img]").eq(2*i).select("img").attr("src");

i have this one : String imagelink = li.select("div[class=img]").eq(i).select("img").attr("src");

balvinderz commented 5 years ago

You need to change this li.select("div[class=img]").eq(2*i).select("img").attr("src"); To String imagelink = li.select("div[class=img]").eq(i).select("img").attr("src");

kiloma commented 5 years ago

i don't have it !

i have this one : String imagelink = li.select("div[class=img]").eq(i).select("img").attr("src");

balvinderz commented 5 years ago

And u need to use this https://www4.gogoanime.io Url

kiloma commented 5 years ago

yes sir, i updated my comment. the problem comes with the new link (https://www4.gogoanime.io)

balvinderz commented 5 years ago

Can u share your whole Mainactivity.java code.

kiloma commented 5 years ago

here

` @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.anime_main);

        toolbar = findViewById(R.id.tool);
        setSupportActionBar(toolbar);
        FragmentManager fm = getSupportFragmentManager();
        noanime = findViewById(R.id.noanime);
        appBarLayout = findViewById(R.id.tabtoolbar);
        anime_adapter viewPagerAdapter;
        viewPager = findViewById(R.id.viewPager);
        appBarLayout.setVisibility(View.VISIBLE);
        SQLiteDatabase recent = openOrCreateDatabase("recent", MODE_PRIVATE, null);
        recent.execSQL("CREATE TABLE IF NOT EXISTS anime(Animename VARCHAR,Episodeno VARCHAR,EPISODELINK VARCHAR,IMAGELINK VARCHAR)");
        progressBar = findViewById(R.id.progress2);
        viewPagerAdapter = new anime_adapter(getSupportFragmentManager());
        viewPager.setOffscreenPageLimit(3);
        viewPager.setAdapter(viewPagerAdapter);

        tabLayout = findViewById(R.id.tabs);
        tabLayout.setupWithViewPager(viewPager);
        viewPager.setCurrentItem(1);
        File[] files = getCacheDir().listFiles();
        long size = 0;
        for (File f : files) size = size + f.length();
        size = size / (1024 * 1024);
        Log.i("cahcesize", String.valueOf(size));

    }

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    getMenuInflater().inflate(R.menu.anime_drawer, menu);
    MenuItem search = menu.findItem(R.id.action_search);
    MenuItem icon_animelist = menu.findItem(R.id.icon_animelist);

    icon_animelist.setOnMenuItemClickListener(menuItem -> {
        Intent i = new Intent(getApplicationContext(), Anime_playList.class);
        startActivity(i);
        return false;
    });

    SearchView searchView = (SearchView) search.getActionView();
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            newText = newText.toLowerCase();
            noanime.setVisibility(View.GONE);

            if (newText.length() >= 3) {
                // mRecyclerView.setVisibility(View.GONE);
                RecyclerView recyclerView = findViewById(R.id.recyclerview2);
                recyclerView.setVisibility(View.VISIBLE);
                appBarLayout.setVisibility(View.GONE);
                searchurl = Constants.url + "/search.html?keyword=" + newText;
                if (x.getStatus() == AsyncTask.Status.RUNNING)
                    x.cancel(true);
                x = new Searching();
                x.execute();

            }

            if (newText.length() <= 2) {
                if (x.getStatus() == AsyncTask.Status.RUNNING)
                    x.cancel(true);
                RecyclerView recyclerView = findViewById(R.id.recyclerview2);
                recyclerView.setVisibility(View.GONE);
                progressBar = findViewById(R.id.progress2);
                appBarLayout.setVisibility(View.VISIBLE);
                progressBar.setVisibility(View.GONE);
                // mRecyclerView.setVisibility(View.VISIBLE);

            }
            return false;
        }
    });
    return true;
}

@Override
public void onBackPressed() {
    try {
        if (!(viewPager.getCurrentItem() == 1))
            viewPager.setCurrentItem(1);
        else
            super.onBackPressed();
    } catch (Exception e) {
        e.printStackTrace();
        super.onBackPressed();
    }
}

private class Searching extends AsyncTask<Void, Void, Void> {
    String desc;

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        RecyclerView recyclerView = findViewById(R.id.recyclerview2);

        recyclerView.setVisibility(View.GONE);

        progressBar.setVisibility(View.VISIBLE);
    }

    @Override
    protected Void doInBackground(Void... params) {
        try {

            org.jsoup.nodes.Document searching = Jsoup.connect(searchurl).get();
            DataAdapter = new animefinderadapter();
            DataAdapter.notifyItemRangeRemoved(0, mAnimeList.size());

            mAnimeList.clear();
            mSiteLink.clear();
            mImageLink.clear();
            mEpisodeList.clear();
            Elements li = searching.select("div[class=main_body]").select("div[class=last_episodes]").select("ul[class=items]").select("li");
            for (int i = 0; i < li.size(); i++) {
                String animelink = li.select("div[class=img]").eq(i).select("a").attr("abs:href");
                String animename = li.select("div[class=img]").eq(i).select("a").attr("title");
                String imagelink = li.select("div[class=img]").eq(i).select("img").attr("src");
                mAnimeList.add(animename);
                mImageLink.add(imagelink);
                mSiteLink.add(animelink);
                mEpisodeList.add("");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        RecyclerView recyclerView = findViewById(R.id.recyclerview2);
        progressBar.setVisibility(View.GONE);

        //   mProgressDialog.dismiss();
        if (mAnimeList.size() == 0)
            noanime.setVisibility(View.VISIBLE);
        else {
            recyclerView.setVisibility(View.VISIBLE);

            DataAdapter = new animefinderadapter(getApplicationContext(), mAnimeList, mSiteLink, mImageLink, mEpisodeList);
            RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
            recyclerView.setHasFixedSize(true);
            recyclerView.setDrawingCacheEnabled(true);
            recyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
            recyclerView.setItemViewCacheSize(30);
           Picasso picasso = Picasso.get();

            recyclerView.setLayoutManager(mLayoutManager);
            recyclerView.setAdapter(DataAdapter);
        }
    }
}

} `

kiloma commented 5 years ago

and this line below : Picasso picasso = Picasso.get();

that picasso is grey as unused.

balvinderz commented 5 years ago

Sorry i was wrong . U need to change
String imagelink = li.select("div[class=img]").eq(2*i).select("img").attr("src"); to String imagelink = li.select("div[class=img]").eq(i).select("img").attr("src"); in AnimeFragment.java

kiloma commented 5 years ago

Thank you it's working Now ♥♥

balvinderz commented 5 years ago

Welcome :)

flitcode commented 5 years ago

I think you should remove the source from github. Many people are using it for commercial use. They are earning with your work.

balvinderz commented 5 years ago

Can you show me any proof ?

flitcode commented 5 years ago

https://play.google.com/store/apps/details?id=com.devilemox.otakuview

https://app.anistream.xyz/

They are not even giving you credit.

balvinderz commented 5 years ago

Thank you for telling me about this . I have removed the source code from github . Also i have reported the google play app . Will not update this repository now :/

yahiaslimani commented 4 years ago

hello sir, I'm working on an arabic-anime scrapping app and i don't know where to start, the technologies and frameworks to use for scrapping... would you please give me a hint about your app ( are the scrapping is done from the server " hosting python application and launching it periodically to update the database" or everything happens in the APK) ?

Cordially,

balvinderz commented 4 years ago

The library i used was jsoup .Similar library in python is BeautifulSoup. Everything happens inside the app . There is no server involved . The website i scaped was https://gogoanimes.ai/.

yahiaslimani commented 4 years ago

Thank you for your quick reply.

The stupid me, i went all the week with Scrappy framework trying to build a web spider to use it later to update the database then each time the user does a refresh in the app it updates the DB in the other side. Would you please guide me to right path?

balvinderz commented 4 years ago

u can look at my source code if you want . Just give me your email id and i will send you the source code.

yahiaslimani commented 4 years ago

Here is my e-mail: ey_slimani@esi.dz

Should i stop manipulating this "web-spiders" thing? Using "Scrapy framework" was not a good choice, right? Have you considered the "cpu over-using" ? cuz the scrapping happen via the user's phone

balvinderz commented 4 years ago

Scrapy is good if you don't want to do the scraping in the phone itself or if the website's structure changes too many time(Then you can change the script on the server itself and you will not need to update your app too many times). But the website i was scraping didn't change much . I rarely updated the scraping part of my app . U can use scrapy if the website changes too much or if you want to support devices before android 6.0 (jsoup only runs on android 6.0 and later).

balvinderz commented 4 years ago

I ran this app on a 2 gb ram device and the app worked fine . There was no cpu over using issue.

balvinderz commented 4 years ago

I sent you the code.

yahiaslimani commented 4 years ago

The code has been well received,

I'll stick with Scrapy then. I noticed that when i choose an episode to play, it redirects me to a player that is a lookalike to the iframe inside the gogoanime website. Weren't you able to extract the direct streaming links ?

Cordially,

balvinderz commented 4 years ago

I was able to get direct streaming links from rapidvideo but they don't use rapidvideo now so as a fallback i use that iframe. The disadvantage of using scrapy ,jsoup , beautifulsoup is u can't scrape content which comes after rendering javascript. I can use htmlunitbrowser(headless browser) but it will take too much to get the links so it's better to show the iframe only.

yahiaslimani commented 4 years ago

I get it now. Just for clarifying, I see only one (.py) file which is generateanimelist.py. Is this the only file used for scrapping?

balvinderz commented 4 years ago

That is used to generate the animelist.json.Other scraping part is done by jsoup.

yahiaslimani commented 4 years ago

I'm truly thankful to you. I hope u don't mind getting to u when i have any further question?

balvinderz commented 4 years ago

I don't mind.But can you email me instead of commenting here?

yahiaslimani commented 4 years ago

i was up to tell you the same thing. Via e-mail then. Have a good day