File tree Expand file tree Collapse file tree 1 file changed +2
-22
lines changed Expand file tree Collapse file tree 1 file changed +2
-22
lines changed Original file line number Diff line number Diff line change @@ -781,32 +781,12 @@ def get_item_list(item_name: str,
781
781
:param instance_id: Instance ID
782
782
:return: Set of items
783
783
"""
784
- pywikibot .debug (f'Search label: { item_name .encode ("utf-8" )} ' )
785
- # TODO: try to use search_entities instead?
786
- params = {
787
- 'action' : 'wbsearchentities' ,
788
- 'format' : 'json' ,
789
- 'type' : 'item' ,
790
- # All languages are searched, but labels are in native language
791
- 'strictlanguage' : False ,
792
- 'language' : mainlang ,
793
- 'uselang' : mainlang , # (primary) Search language
794
- 'search' : item_name , # Get item list from label
795
- 'limit' : 20 , # Should be reasonable value
796
- }
797
- request = api .Request (site = repo , parameters = params )
798
- result = request .submit ()
799
- pywikibot .debug (result )
800
-
801
- if 'search' not in result :
802
- return set ()
803
-
804
784
# Ignore accents and case
805
785
item_name_canon = unidecode (item_name ).casefold ()
806
786
807
787
item_list = set ()
808
- # Loop though items
809
- for res in result [ 'search' ] :
788
+ # Loop though items, total should be reasonable value
789
+ for res in repo . search_entities ( item_name , mainlang , total = 20 ) :
810
790
item = get_item_page (res ['id' ])
811
791
812
792
# Matching instance
You can’t perform that action at this time.
0 commit comments