Skip to content

Commit de049f5

Browse files
committed
Set APOD title and description only on first fetch.
1 parent 3afbbf5 commit de049f5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Apod.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ bool Apod::FetchImpl( bool first )
3131
auto article = FetchDom( page );
3232
if( !article ) return false;
3333

34-
auto title = article->select_node( "/html/head/title" );
35-
m_title = title ? title.node().text().as_string() : "APOD";
34+
if( first )
35+
{
36+
auto title = article->select_node( "/html/head/title" );
37+
m_title = title ? title.node().text().as_string() : "APOD";
3638

37-
auto desc = article->select_node( "/html/head/meta[@name='description']" );
38-
m_description = desc ? desc.node().attribute( "content" ).as_string() : "";
39+
auto desc = article->select_node( "/html/head/meta[@name='description']" );
40+
m_description = desc ? desc.node().attribute( "content" ).as_string() : "";
41+
}
3942

4043
std::string url;
4144
{

0 commit comments

Comments
 (0)