New scrapy for loop question

hi i’m using scrapy for the first tiem and
trying to use for loop twice, but it looks like 2nd loop fail at this point
(# 2nd category crawling),
could i get some help?

my code …

import scrapy

from test123.items import Test123Item

class GmarketSpider(scrapy.Spider):

name = 'gmarket'

def start_requests(self):

    yield scrapy.Request(url='http://corners.gmarket.co.kr/Bestsellers', callback=self.parse_mainpages)

def parse_mainpages(self, response):

    print("parse_mainpages")

    category_links = response.css('div.gbest-cate ul.by-group li a::attr(href)').getall()

    category_names = response.css('div.gbest-cate ul.by-group li a::text').getall()

    # 1st category crawling

    for category_name, category_link in zip(category_names,category_links):

        yield scrapy.Request(url='http://corners.gmarket.co.kr' + category_link, callback=self.parse_items, meta={'main_category_name':category_name, 'sub_category_name': 'ALL' })

        print('=========================================================================')

    # 2nd category crawling

    for category_name, category_link in zip(category_names,category_links):

        print('*********************************')

        yield scrapy.Request(url='http://corners.gmarket.co.kr' + category_link, callback=self.parse_subcategory, meta={'main_category_name':category_name })

def parse_subcategory(self, response):

    print ("parse_subcategory", response.meta['main_category_name'])

    subcategory_links = response.css('div.navi.group > ul > li > a::attr(href)').getall()

    sub_category_names = response.css('div.navi.group > ul > li > a::text').getall()

    for index, subcategory_link in enumerate(subcategory_links):

        yield scrapy.Request(url='http://corners.gmarket.co.kr' + subcategory_link, callback=self.parse_items, meta={'main_category_name':response.meta['main_category_name'], 'sub_category_name':sub_category_names[index] })

def parse_items(self, response):

    best_items = response.css('div.best-list')

    for index, item in enumerate(best_items[1].css('li')):

        doc = Test123Item()

        ranking = index + 1

        title = item.css('a.itemname::text').get()

        ori_price = item.css('div.o-price::text').get()

        dis_price = item.css('div.s-price strong span span::text').get()

        discount_percent = item.css('div.s-price em::text').get()

        if ori_price == None:

            ori_price = dis_price

        ori_price = ori_price.replace(",", "").replace("원", "")

        dis_price = dis_price.replace(",", "").replace("원", "")

        if discount_percent == None:

            discount_percent = '0'

        else:

            discount_percent = discount_percent.replace("%", "")

        doc['main_category_name'] = response.meta['main_category_name'] 

        doc['sub_category_name'] = response.meta['sub_category_name']

        doc['ranking'] = ranking

        doc['title'] = title

        doc['ori_price'] = ori_price

        doc['dis_price'] = dis_price

        doc['discount_percent'] = discount_percent

        #print (ranking, title, ori_price, dis_price, discount_percent)

        yield doc

and my items.py is

import scrapy

class Test123Item(scrapy.Item):

main_category_name = scrapy.Field()

sub_category_name = scrapy.Field()

ranking = scrapy.Field()

title = scrapy.Field()

ori_price = scrapy.Field()

dis_price = scrapy.Field()

discount_percent=scrapy.Field()