我有以下选择表单。我想把它变成一个复选框。我已经尝试了一段时间但无济于事。我很感激你的帮助
import scrapy
from scrapy.contrib.spiders import Rule, CrawlSpider
from scrapy.contrib.linkextractors import LinkExtractor
from imgur.items import ImgurItem
class ImgurSpider(CrawlSpider):
name = 'imgur'
allowed_domains = ['someurl.com/']
start_urls = ['http://someurl.com/news']
rules = [Rule(LinkExtractor(allow=('/node/.*')), callback='parse_imgur', follow=True)]
def parse_imgur(self, response):
image = ImgurItem()
image['title'] = response.xpath(\
"//h1[@class='pane-content']/a/text()").extract()
rel = response.xpath("//img/@src").extract()
image['image_urls'] = response.xpath("//img/@src").extract()
return image
答案 0 :(得分:2)
下面的内容应该
var chats = []; // global in this instance
var promise = $http.get("http://127.0.0.1:5000/mobile/")
.then(function (response) {
console.log(response.data.hits);
for(var i=0; i < response.data.hits.length; i++)
{
console.log(response.data.hits[i]._id);
}
chats = response.data.hits; // assign hits[] to chats
return response.data;
});
if(chats.length !== 0)
// do something