mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-04 02:50:55 +01:00 
			
		
		
		
	Merge pull request #86 from Alocks/dev
Fixed parser to work with new options, and updated readme
This commit is contained in:
		
							
								
								
									
										30
									
								
								README.rst
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								README.rst
									
									
									
									
									
								
							@@ -74,6 +74,36 @@ Download by tag name:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    nhentai --tag lolicon --download --page=2
 | 
					    nhentai --tag lolicon --download --page=2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Download by artist name:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    nhentai --artist henreader --download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Download by character name:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    nhentai --character kuro von einsbern --download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Download by parody name:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    nhentai --parody the idolmaster --download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Download by group name:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    nhentai --group clesta --download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Download using multiple tags (--tag, --character, --paordy and --group supported):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    nhentai --tag lolicon, teasing --artist tamano kedama, atte nanakusa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Download your favorites with delay:
 | 
					Download your favorites with delay:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block:: bash
 | 
					.. code-block:: bash
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -189,19 +189,28 @@ def print_doujinshi(doujinshi_list):
 | 
				
			|||||||
                tabulate(tabular_data=doujinshi_list, headers=headers, tablefmt='rst'))
 | 
					                tabulate(tabular_data=doujinshi_list, headers=headers, tablefmt='rst'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def tag_parser(tag_name, sorting='date', max_page=1):
 | 
					def tag_parser(tag_name, sorting='date', max_page=1, index=0):
 | 
				
			||||||
    result = []
 | 
					    result = []
 | 
				
			||||||
    tag_name = tag_name.lower()
 | 
					    tag_name = tag_name.lower()
 | 
				
			||||||
    tag_name = tag_name.replace(' ', '-')
 | 
					    if ',' in tag_name:
 | 
				
			||||||
 | 
					        tag_name = [i.strip().replace(' ', '-') for i in tag_name.split(',')]
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        tag_name = tag_name.replace(' ', '-')
 | 
				
			||||||
    if sorting == 'date':
 | 
					    if sorting == 'date':
 | 
				
			||||||
        sorting = ''
 | 
					        sorting = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for p in range(1, max_page + 1):
 | 
					    for p in range(1, max_page + 1):
 | 
				
			||||||
        logger.debug('Fetching page {0} for doujinshi with tag \'{1}\''.format(p, tag_name))
 | 
					        if isinstance(tag_name, str):
 | 
				
			||||||
        response = request('get', url='%s/%s/%s?page=%d' % (constant.TAG_URL, tag_name, sorting, p)).content
 | 
					            logger.debug('Fetching page {0} for doujinshi with tag \'{1}\''.format(p, tag_name))
 | 
				
			||||||
 | 
					            response = request('get', url='%s/%s/%s?page=%d' % (constant.TAG_URL[index], tag_name, sorting, p)).content
 | 
				
			||||||
 | 
					            result += _get_title_and_id(response)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            for i in tag_name:
 | 
				
			||||||
 | 
					                logger.debug('Fetching page {0} for doujinshi with tag \'{1}\''.format(p, i))
 | 
				
			||||||
 | 
					                response = request('get',
 | 
				
			||||||
 | 
					                                   url='%s/%s/%s?page=%d' % (constant.TAG_URL[index], i, sorting, p)).content
 | 
				
			||||||
 | 
					                result += _get_title_and_id(response)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        result += _get_title_and_id(response)
 | 
					 | 
				
			||||||
        if not result:
 | 
					        if not result:
 | 
				
			||||||
            logger.error('Cannot find doujinshi id of tag \'{0}\''.format(tag_name))
 | 
					            logger.error('Cannot find doujinshi id of tag \'{0}\''.format(tag_name))
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user