MediaElch icon indicating copy to clipboard operation
MediaElch copied to clipboard

Network error on movie scrapers when searching text (since MacOSTahoe?)

Open jmmelko opened this issue 5 months ago • 12 comments

Describe the bug Scraping for movies does not work anymore. I have the following systematic error: Network error: impossible to open requested resource

To Reproduce Steps to reproduce the behavior:

  1. Select any movie file
  2. Click on scrape (any scraper, any language)
  3. Search by keywords

Even though internet is working, the scraper websites are online, no firewall, etc

Steps to circumvent the behavior:

  • Do the same with a TV scraper
  • Do the same with a movie scraper searching by idXXXXXXXX

MediaElch Version:

  • [X] 2.12.1-dev (nightly)

Operating System:

  • [ ] Windows
  • [X] macOS Tahoe 26.5.1
  • [ ] Linux (distribution: .)

Console log

par défaut	17:35:39.318919+0200	MediaElch	establishing connection to agent
par défaut	17:35:39.319032+0200	MediaElch	[0x600002575ef0] Session created.
par défaut	17:35:39.319052+0200	MediaElch	[0x600002575ef0] Session created from connection [0x7fee8c11a9a0]
par défaut	17:35:39.319097+0200	MediaElch	[0x7fee8c11a9a0] activating connection: mach=true listener=false peer=false name=com.apple.uiintelligencesupport.agent
par défaut	17:35:39.319305+0200	MediaElch	[0x600002575ef0] Session activated
par défaut	17:35:39.321990+0200	MediaElch	Connection established with agent PID: 1389
par défaut	17:35:39.324520+0200	MediaElch	[0x7fee8c188c50] activating connection: mach=false listener=false peer=false name=com.apple.TextInputUI.xpc.CursorUIViewService
par défaut	17:35:39.325153+0200	MediaElch	[0x7fee8c188c50] invalidated after the last release of the connection object
par défaut	17:35:39.392146+0200	MediaElch	[0x7fee8c0101d0] activating connection: mach=false listener=false peer=false name=(anonymous)
par défaut	17:35:39.392195+0200	MediaElch	[0x7fee5c2a29a0] activating connection: mach=false listener=false peer=false name=(anonymous)
par défaut	17:35:39.406409+0200	MediaElch	-[TUINSCursorUIController activate:]_block_invoke: Create CursorUIViewService: TUINSRemoteViewController
par défaut	17:35:39.406667+0200	MediaElch	[0x7fee6b81f870] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
par défaut	17:35:39.406680+0200	MediaElch	[0x7fee5c24daa0] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
par défaut	17:35:39.560383+0200	MediaElch	CSInlineDonation:<private>: Skipping donation (feature flag disabled)
par défaut	17:35:39.560657+0200	MediaElch	[0x7fee5c0d3f00] Re-initialization successful; calling out to event handler with XPC_ERROR_CONNECTION_INTERRUPTED
par défaut	17:35:39.560678+0200	MediaElch	### Connection error 0x600001c94dc0 Connection interrupted for com.apple.spotlight.IndexAgent
par défaut	17:35:39.560796+0200	MediaElch	CSInlineDonation:<private>: Skipping donation (feature flag disabled)
par défaut	17:35:39.561000+0200	MediaElch	[0x7fee5c0d3f00] Re-initialization successful; calling out to event handler with XPC_ERROR_CONNECTION_INTERRUPTED
par défaut	17:35:39.561012+0200	MediaElch	### Connection error 0x600001c94dc0 Connection interrupted for com.apple.spotlight.IndexAgent
par défaut	17:35:40.673139+0200	MediaElch	[0x7fee8c024140] activating connection: mach=false listener=false peer=false name=(anonymous)
par défaut	17:35:40.674027+0200	MediaElch	[0x7fee5e160080] activating connection: mach=false listener=false peer=false name=com.apple.TextInputUI.xpc.CursorUIViewService
par défaut	17:35:40.674293+0200	MediaElch	[0x7fee5e160080] invalidated after the last release of the connection object
par défaut	17:35:40.678327+0200	MediaElch	-[TUINSCursorUIController scheduleUpdateCursorLocation]
par défaut	17:35:40.961380+0200	MediaElch	[0x7fee5e1c8590] activating connection: mach=false listener=false peer=false name=(anonymous)
par défaut	17:35:40.961477+0200	MediaElch	[0x7fee5c0a5950] activating connection: mach=false listener=false peer=false name=(anonymous)
par défaut	17:35:40.963799+0200	MediaElch	nw_path_libinfo_path_check [1C26A925-76BC-408F-86B2-3447CC11C92E Hostname#77b19661:0 tcp, legacy-socket, attribution: developer]
	libinfo check path: <private>
par défaut	17:35:41.008639+0200	MediaElch	-[TUINSCursorUIController activate:]_block_invoke: Create CursorUIViewService: TUINSRemoteViewController
par défaut	17:35:41.009027+0200	MediaElch	[0x7fee5c2a29a0] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
par défaut	17:35:41.009041+0200	MediaElch	[0x7fee8c0101d0] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
par défaut	17:35:41.022619+0200	MediaElch	nw_path_evaluator_start [7C7E7684-F428-418C-B212-8C0A701BE109 IPv4#aaabe284:0 generic, local: 192.168.1.44:0, attribution: developer]
	path: <private>
par défaut	17:35:41.164755+0200	MediaElch	CSInlineDonation:<private>: Skipping donation (feature flag disabled)
par défaut	17:35:41.165652+0200	MediaElch	[0x7fee5c0d3f00] Re-initialization successful; calling out to event handler with XPC_ERROR_CONNECTION_INTERRUPTED
par défaut	17:35:41.165714+0200	MediaElch	### Connection error 0x600001c94dc0 Connection interrupted for com.apple.spotlight.IndexAgent
par défaut	17:35:41.166007+0200	MediaElch	CSInlineDonation:<private>: Skipping donation (feature flag disabled)
par défaut	17:35:41.166572+0200	MediaElch	[0x7fee5c0d3f00] Re-initialization successful; calling out to event handler with XPC_ERROR_CONNECTION_INTERRUPTED
par défaut	17:35:41.166610+0200	MediaElch	### Connection error 0x600001c94dc0 Connection interrupted for com.apple.spotlight.IndexAgent
par défaut	17:35:42.521964+0200	MediaElch	[0x7fee5c730f80] activating connection: mach=false listener=false peer=false name=com.apple.TextInputUI.xpc.CursorUIViewService
par défaut	17:35:42.522330+0200	MediaElch	[0x7fee5c730f80] invalidated after the last release of the connection object
par défaut	17:35:42.804023+0200	MediaElch	[0x7fee8c024140] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
par défaut	17:35:42.804341+0200	MediaElch	[0x7fee5e12b4d0] activating connection: mach=false listener=false peer=false name=(anonymous)
par défaut	17:35:42.804452+0200	MediaElch	[0x7fee7b72fc70] activating connection: mach=false listener=false peer=false name=(anonymous)
par défaut	17:35:42.866427+0200	MediaElch	-[TUINSCursorUIController activate:]_block_invoke: Create CursorUIViewService: TUINSRemoteViewController
par défaut	17:35:42.866695+0200	MediaElch	[0x7fee5c0a5950] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
par défaut	17:35:42.866707+0200	MediaElch	[0x7fee5e1c8590] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
par défaut	17:35:43.007087+0200	MediaElch	CSInlineDonation:<private>: Skipping donation (feature flag disabled)
par défaut	17:35:43.007735+0200	MediaElch	[0x7fee5c0d3f00] Re-initialization successful; calling out to event handler with XPC_ERROR_CONNECTION_INTERRUPTED
par défaut	17:35:43.007781+0200	MediaElch	### Connection error 0x600001c94dc0 Connection interrupted for com.apple.spotlight.IndexAgent
par défaut	17:35:43.007970+0200	MediaElch	CSInlineDonation:<private>: Skipping donation (feature flag disabled)
par défaut	17:35:43.008730+0200	MediaElch	[0x7fee5c0d3f00] Re-initialization successful; calling out to event handler with XPC_ERROR_CONNECTION_INTERRUPTED
par défaut	17:35:43.008768+0200	MediaElch	### Connection error 0x600001c94dc0 Connection interrupted for com.apple.spotlight.IndexAgent
par défaut	17:35:43.405627+0200	MediaElch	void _updateToReflectAutomaticTerminationState(void) Setting _kLSApplicationWouldBeTerminatedByTALKey=0
par défaut	17:35:43.501235+0200	MediaElch	-[NSPersistentUIManager flushAllChanges]
par défaut	17:35:43.501313+0200	MediaElch	-[NSPersistentUIManager flushAllChanges] finishing enqueued operations
par défaut	17:35:43.501339+0200	MediaElch	-[NSPersistentUIManager flushAllChanges]_block_invoke asyncing to main queue
par défaut	17:35:43.501362+0200	MediaElch	-[NSPersistentUIManager flushAllChanges]_block_invoke writing records

jmmelko avatar Jun 21 '26 15:06 jmmelko

Same here on Linux, Ubuntu 24.04

Ubuntubirdy avatar Jun 22 '26 14:06 Ubuntubirdy

same on windows 11

DarkMatter26 avatar Jun 25 '26 16:06 DarkMatter26

I think I found the bug. MediaElch puts the includeAdult parameter in the request URL twice. Example: https://api.themoviedb.org/3/search/movie?page=1&query=HANS ZIMMER Diamond In The Desert&include_adult=false&year=2025&include_adult=false&api_key=5d832bdf69dcb884922381ab01548d5b&language=de-DE&region=DE The API returns: {"success":false,"status_code":5,"status_message":"Invalid parameters: Your request parameters are incorrect."}

But by deleting the first includeAdult parameter, the URL is: https://api.themoviedb.org/3/search/movie?page=1&query=HANS%20ZIMMER%20Diamond%20In%20The%20Desert&year=2025&include_adult=false&api_key=5d832bdf69dcb884922381ab01548d5b&language=de-DE&region=DE and the API returns correctly: "{"page":1,"results":[{"adult":false,"backdrop_path":"/fYN7UVruGPJxA3c7yGHQ4R9OHF0.jpg","genre_ids":[10402,99],"id":1425725,"title":"Hans Zimmer & Friends: Diamond in the Desert","original_language":"en","original_title":"Hans Zimmer & Friends: Diamond in the Desert","overview":"Diamond in the Desert zeigt eine außergewöhnliche Live-Performance einiger der beliebtesten Kompositionen von Zimmer, darunter Musik aus Dune, Gladiator, Interstellar, König der Löwen und vieles mehr. Jahrzehnte filmischer Meisterwerke werden..." (Output is abbreviated).

So, I looked in the source code and maybe this code change in the TmdbApi.cpp file at line 235 could help:

    queries.addQueryItem("page", "1"); // Only query first page as of now.
    queries.addQueryItem("query", searchStr);


    // Check if INCLUDE_ADULT is in the parameters map to avoid duplicates
    bool includeAdultInMap = parameters.contains(TmdbApi::ApiUrlParameter::INCLUDE_ADULT);
    
    const auto keys = parameters.keys();
    for (const auto& key : keys) {
        queries.addQueryItem(apiUrlParameterString(key), parameters.value(key));
    }

    // Only add include_adult from the parameter if it's not already in the map
    if (!includeAdultInMap) {
        queries.addQueryItem("include_adult", includeAdult ? "true" : "false");
    }

    return makeApiUrl("/search/movie", locale, queries);

The duplicate include_adult parameter was added in getMovieSearchUrl(). The function was adding include_adult once from the includeAdult boolean parameter, and then again when processing the parameters map (via apiUrlParameterString()).

With the change the function checks if INCLUDE_ADULT is already in the parameters map before adding it from the includeAdult parameter. This ensures include_adult is only added once to the API URL.

@Komet Could you give this change a try?

justanotherjurastudent avatar Jul 04 '26 13:07 justanotherjurastudent

Did you guys try to hr new nightly builds might of fixed it

kolbdog323 avatar Jul 04 '26 13:07 kolbdog323

Did you guys try to hr new nightly builds might of fixed it

Thanks for your message. No, I did not try it. But now I've installed the latest nightly build from 2026-Jun-19 00:32:49. And now it worked again, at least for me on windows 11. So, thanks for your clue.

justanotherjurastudent avatar Jul 04 '26 14:07 justanotherjurastudent

I'm also having the same issue on macOS Tahoe 26.5 with 2.12.1-dev (nightly) (MediaElch_macOS_Qt6_2.12.1-dev_2026-01-17_17-13_git-master-a7263f0b.dmg)

AshDevFr avatar Jul 11 '26 19:07 AshDevFr

same issue with latest builds on Tahoe. Completely unusable when doing text searches in scraping for over a month now. I will note that if I figure out the ID outside the app and add it to the movie data, THEN searching works fine. Just not without the ID up front.

dv8godd avatar Jul 17 '26 00:07 dv8godd

Confirming @justanotherjurastudent's diagnosis. Root cause is the duplicated include_adult query parameter, and TMDb now rejects any request that carries the same parameter twice with HTTP 400 (status_code 5). It used to silently tolerate the duplicate, which is why text searches broke seemingly overnight rather than after a MediaElch change.

I checked current master: the duplicate is still there. The two copies come from different layers:

  • TmdbMovieSearchJob::doStart() (src/scrapers/movie/tmdb/TmdbMovieSearchJob.cpp) passes include_adult in the UrlParameterMap, and
  • TmdbApi::getMovieSearchUrl() also adds it from the explicit includeAdult bool argument.

Both the plain-search and the year-suffixed-search paths emit it twice.

@justanotherjurastudent's patch works. As an alternative that leaves getMovieSearchUrl() untouched, you can fix it at the caller by dropping the redundant map entry, since the bool argument already covers it:

// plain search
QUrl newUrl(m_api.getMovieSearchUrl(searchStr,
    config().locale,
    config().includeAdult,
    TmdbApi::UrlParameterMap{}));

// year search
QUrl newSearchUrl = m_api.getMovieSearchUrl(searchTitle,
    config().locale,
    config().includeAdult,
    TmdbApi::UrlParameterMap{{TmdbApi::ApiUrlParameter::YEAR, searchYear}});

Either fix resolves it. Built locally on Linux (Qt 6.11, 2.12.1-dev) with the caller-side change and text searches return results again. curl confirms the mechanism directly: the deduped URL returns 200, the duplicated one returns {"success":false,"status_code":5,"status_message":"Invalid parameters..."}.

0x90shell avatar Jul 27 '26 21:07 0x90shell

Any chance for a precompiled version with the bugfix, for non-developers like me :-)?

gitralf avatar Sep 02 '26 15:09 gitralf

Any chance for a precompiled version with the bugfix, for non-developers like me :-)?

For me, the nightly build (2.12.1-dev) helped to resolve the bug: https://mediaelch-downloads.ameyering.de/snapshots/Windows_10_or_later/

justanotherjurastudent avatar Sep 03 '26 18:09 justanotherjurastudent

This has been an ongoing issue since June (probably earlier than that since I'm too lazy to keep looking for similar issues) and this has still not been fixed?

usafle avatar Oct 06 '26 14:10 usafle

Any chance for an updated build that works for macOS? 2.12.1-dev for mac doesn't fix the issue.

dv8godd avatar Oct 18 '26 21:10 dv8godd